Markdown without HTML

I mainly use Markdown to write for conversion into different output formats (e.g. LaTeX) so HTML blocks are of little use. The specification should mention that raw HTML blocks can also be ignored when processing to some other format beside HTML.

Which tool do you use for these conversions? (If it’s pandoc: no, pandoc doesn’t ignore raw HTML blocks…)

Anyway – so far this spec (how I understand it) deals with the inital core of Markdown and its purpose: which was to convert Markdown to HTML (nothing else).

I guess, statements about behaviors about all the other target formats will have to be left for future extensions of ‘standard markdown’, or for the respective tools which process standard markdown into non-HTML formats…

I use Pandoc to generate Latex output from Markdown source, and the ability to have HTML blocks is extremely useful. By default, Pandoc does nothing with those blocks. But you can write filters which turn those blocks into arbitrary Latex code. So suppose you want a centered piece of text in Latex. Then you can write:

<div class="centered">

Paragraph here with *markdown* **styles**.

</div>

With filters, you can turn that into the right Latex code for centering text. The cool thing, though, is you can generate arbitrary code with this. Want to put \noindent at the start of a paragraph? Define a filter for class=“noindent”. What to render a paragraph in sanserif font? Define a class=“sanserif” filter. Etc.

1 Like

Oh, interesting approach! I used code blocks with custom info strings for filtering, but HTML div can also contain Markdown. Nevertheless the standard should tell what to do with HTML sections by default if not converting to HTML. Maybe conversion to an Abstract Syntax Tree could eleminate the view of the current spec with HTML as only target format.