rst2pdf

Sphinx: Use a different directive for a different output format

。_饼干妹妹 提交于 2020-03-15 07:15:06
问题 Assume you have a reStructuredText document and want to export it in two formats using Sphinx 2.x: HTML and PDF. You want to put some slightly different contents in these two formats. For example, the text "I am HTML" appears in the HTML version whereas "I am PDF" appears in the PDF version in the same location of the document. Use a replace directive like below will give you "I am HTML" regardless of the export format. .. |foo| replace:: HTML ⋮ I am |foo| Can you use a different directive