lierdakil / pandoc-crossref

Pandoc filter for cross-references
https://lierdakil.github.io/pandoc-crossref/
GNU General Public License v2.0
909 stars 73 forks source link

place pandoc crossref attributes in new line #396

Open fcskit opened 11 months ago

fcskit commented 11 months ago

This is not a major issue but it would be nice if a single line break would be supported between a markdown heading or figure and a pandoc crossref attribute in curly brackets. Currently I'm receiving an error if I place a section {#sec:seclabel} or figure attribute {#fig:label} in a new line directly after a heading or figure.

So this works:

# Heading {#sec:seclabel}
![image caption](link_to_image.png){#fig:figlabel}

but this won't

# Heading
{#sec:seclabel}

![image caption](link_to_image.png)
{#fig:figlabel}

Personally the latter is more readable to me. In particular since some markdown editors support some kind of live preview and having a heading rendered in bold letters and large font size including a {#sec:seclabel} attribute just doesn't look very nice.

lierdakil commented 11 months ago

Pandoc can't parse this, so nothing I could do on pandoc-crossref side. Feel free to take this upstream

But there are issues with the proposed syntax, e.g.

# ![image caption](link_to_image.png)
{#somelabel}

what's this? There's ambiguity.

With the current setup, image attributes require no whitespace between the image and {, so this is not ambiguous:

# ![image caption](link_to_image.png) {#somelabel}