markdown
markdown copied to clipboard
Heading labels
Currently, \label{}s are only generated for tables and figures, it appears. With headerAttributes=true, headings can get HTML attributes including, according to the examples, of the shape {#foo} which
currently have no effect other than enabling content slicing, see the
sliceoption.
When writing a paper with some of its content in Markdown, it would be very nice to be able to provide internal cross-references to sections. I can, obviously, use mixed mode and provide manual \label{}s, but given that the HTML attribute syntax already exists, is parsed and used for some purpose, wouldn't it make sense to use it (maybe optionally) also for generating heading labels?
Currently, \label{}s are only generated for tables and figures, it appears.
Sorry to say that labels are currently not generated at all, not even for tables or figures.
wouldn't it make sense to use it (maybe optionally) also for generating heading labels?
It would be a welcome feature, but I currently do not have the time to implement it. In June, perhaps, or if someone else is interested in implementing the feature.
Ah. I had just been searching for \label in the technical documentation and https://github.com/Witiko/markdown/blob/42853fdae267a2dc8bf0e91477086727610dae21/markdown.dtx#L16496 in a fitting context made me think that tables got labels, similarly for figures.
What I said above was not entirely true. Figures do receive labels with the default LaTeX renderer prototypes:  can be referenced as \ref{fig:an-example}.
Tables do not receive labels: line 16,496 only applies to CSV files specified through content blocks and it does nothing useful, only redefines label tab:csv. Thanks for noticing, I removed the line in 4b516f7.
pandoc-crossref is a useful project which provides additional features for cross reference (figure, table, equation and section) in Markdown. So it would be great if markdown package could support the syntax of pandoc-crossref.
Header identifiers current produce \labels now:
\begin{markdown}[headerAttributes, relativeReferences]
We list previous work in Section <#previous-work>.
# Previous work {#previous-work}
We previously worked on the previous sections.
Now, we are hard at work on this one.
\end{markdown}
Options autoIdentifiers and gfmAutoIdentifiers will produce \labels automatically for you:
\begin{markdown}[autoIdentifiers, relativeReferences]
We list previous work in Section <#previous-work>.
# Previous work
We previously worked on the previous sections.
Now, we are hard at work on this one.
\end{markdown}
Closing this issue, please feel free to reopen it if you are unhappy with the current implementation.