Replies: 4 comments
-
Hugo supports markdown attributes on images and block-level elements including blockquotes, fenced code blocks, headings, lists, paragraphs, and tables. Please see: Attributes may be added to links using a markdown render hook. If you have further questions, please create a topic on the hugo forum. |
Beta Was this translation helpful? Give feedback.
-
Hi, Thanks for that info. However it doesn't support attributes on links, which is my use case. I would say it's a pretty common use case too. Shouldn't these things be supported at the level of the markdown processor? |
Beta Was this translation helpful? Give feedback.
-
And there's are couple of ways to do it. If you have further questions, please create a topic on the hugo forum. |
Beta Was this translation helpful? Give feedback.
-
As there is already support in the goldmark for headings can this attributes support be also extended for other elements? |
Beta Was this translation helpful? Give feedback.
-
Hi,
Thanks for goldmark, I use it from hugo for my blog. I'd like to suggest a feature, to allow custom attributes to be added to html elements such as links. My use-case is to add rel="nofollow" to links, but I can imagine other elements might benefit too, for example adding a one-off class to an element. I spent a lot of time trying to work out how to get this working, I think it would save others much time too if they ever need to customize attributes on their markdown.
There is an npm package which has similar features here: https://www.npmjs.com/package/markdown-it-attrs
Example input:
Example output:
Thanks very much for considering this.
Beta Was this translation helpful? Give feedback.
All reactions