Skip to content
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

Handle colon style markdown link_attributes #8089

Open
mcdemarco opened this issue May 26, 2022 · 6 comments
Open

Handle colon style markdown link_attributes #8089

mcdemarco opened this issue May 26, 2022 · 6 comments

Comments

@mcdemarco
Copy link

Some markdown link attribute extensions seem to begin link attributes with a :, but -f markdown+link_attributes does not support this style and parses such link attributes as plain text. For a flavor of markdown that uses the : for this extension, see Python markdown. (While the colon is optional now, I'm working with a codebase that still requires it due to an issue with their tools.)

Tested with pandoc 2.16 and 2.18 on MacOS.

@mb21
Copy link
Collaborator

mb21 commented May 30, 2022

Is this a feature request? With what exact input and command would you want what exact output?

@mcdemarco
Copy link
Author

Is this a feature request? With what exact input and command would you want what exact output?

Yes, it's a feature request, as, I think, is indicated by the enhancement label. The input is markdown; the command is -f markdown+link_attributes to invoke the link_attributes extension. This extension should ignore a leading : inside the link attribute; e.g.,

[my link text](my/link/url.html){: #someid .someclass somekey='some value' }

should be treated the same as

[my link text](my/link/url.html){ #someid .someclass somekey='some value' }

While I am only experiencing this issue with link attributes, Python Markdown permits the colon in all supported attribute lists, and it would not be a bad idea to allow it in related markdown extensions (definitely header_attributes and fenced_code_attributes, and possibly inline_code_attributes and attributes). I'm not sure what other implementations use the colon this way, so I'm not sure whether attribute lists that don't occur in Python Markdown would need to be supported.

@jgm
Copy link
Owner

jgm commented May 31, 2022

I haven't seen this. Is Python Markdown the only implementation that does this?
If so, and if they are now making the colon optional, then I'm hesitant to make changes.

@mb21
Copy link
Collaborator

mb21 commented Jun 1, 2022

Is it the same syntax as Kramdown, we have an issue on that: #2711 (comment)

@mcdemarco
Copy link
Author

Is it the same syntax as Kramdown, we have an issue on that: #2711 (comment)

The colon is used this way in kramdown, see, for example, the quick ref, but the linked issue covers all kramdown parsing, not just the colon.

@jgm
Copy link
Owner

jgm commented Jun 1, 2022

I note that the kramdown attribute syntax has many other differences: attributes are placed after blocks, and can occur in many places where pandoc attributes can't, but can't occur in some places where pandoc attributes can. So, just allowing the colon wouldn't move us any closer to kramdown compatibility. I haven't checked to see if the same is true of Python markdown.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants