-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
when --toc
, GFM now outputs raw HTML instead or Markdown syntax for TOC
#8131
Comments
It's a consequence of #7907. I can see why this would be undesirable for markdown output if the markdown flavor doesn't allow you to encode the ID attribute. I can think of a few potential solutions:
1 seems simplest, but it's hard to predict whether people are already relying on these anchors for their gfm output. |
1 is indeed the simplest and what I would have expected probably when I asked on Pandoc-discuss. I should have maybe open an issue here as I discovered when it was only in Nightly at the time. I understand that 2 could be more desirable now in case people are already using it. Sorry for that. Regarding 2, do you mean like it was before with
Which is now with Pandoc 2.18 following the ID change:
If so, this will be two spans following in this case
Unless we can merge into one and put the ID or that |
I'd strongly prefer the first option; the switch to a new epoch version seems like a good opportunity to introduce some minor breakage. Besides, I'd be quite surprised to learn that people rely on this when targeting gfm. |
Yes, the first option seems best to me too. |
If #8485 gets merged in its current form then the old behavior could be restored with a custom writer: Template = pandoc.template.default 'markdown'
function Writer (doc, opts)
local toc = pandoc.structure.table_of_contents(doc)
opts.variables['table-of-contents'] =
pandoc.write(pandoc.Pandoc{toc}, 'gfm')
return pandoc.write(doc, 'gfm', opts)
end |
…ML instead of Markdown closes #2445 following jgm/pandoc#8131
This is a follow up of https://groups.google.com/g/pandoc-discuss/c/gQZrKunCvB4/m/j7177M-3BwAJ which remained unanswered.
With recent Pandoc (here 2.18), we have this type of outputs
I believe this is a consequence to this change #7907. By adding ids on all TOC elements, it triggers raw HTML as output to keep the id in markdown, if
raw_html
is possible.Is this expected that now activating TOC for markdown output will always return HTML except if
raw_html
extensions is deactivated ?I am not sure adding ID on TOC link by default is something expected for Markdown output. For HTML, I guess it does not hurt.
Adding ID on TOC could be not set by default for markdown output maybe, or be part of an extension that could be deactivated ?
We adapted to this change of having raw HTML for TOC now, but I wanted to bring this change to discussion and confirm it is expected and not an unknown side effect
Thanks.
The text was updated successfully, but these errors were encountered: