You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, if converting from HTML to Markdown, if the document contains code blocks, that is, pre elements, they are converted to fenced code blocks if Pandoc can determine their language and to indented ones otherwise. That is, the output Markdown file may have both fenced and indented code blocks.
It seems to me, however, that fenced-vs-indented-code-blocks thing is a matter of taste. That is, some people prefer indented code blocks and some prefer fenced. And for this reason, it will be absolutely reasonable to provide an option to use only a single style across the whole document. Currently, I use a Lua filter for this, but having a built-in command-line option will be a better solution.
-- https://stackoverflow.com/q/66945893
local fenced = '```\n%s\n```\n'
function CodeBlock (cb)
if cb.classes[1] or cb.attributes[1] then
return nil
end
return pandoc.RawBlock('markdown', fenced:format(cb.text))
end
The text was updated successfully, but these errors were encountered:
Currently, if converting from HTML to Markdown, if the document contains code blocks, that is,
pre
elements, they are converted to fenced code blocks if Pandoc can determine their language and to indented ones otherwise. That is, the output Markdown file may have both fenced and indented code blocks.It seems to me, however, that fenced-vs-indented-code-blocks thing is a matter of taste. That is, some people prefer indented code blocks and some prefer fenced. And for this reason, it will be absolutely reasonable to provide an option to use only a single style across the whole document. Currently, I use a Lua filter for this, but having a built-in command-line option will be a better solution.
The text was updated successfully, but these errors were encountered: