feature idea: special attributes from PHP Markdown Extra
https://michelf.ca/projects/php-markdown/extra/#spe-attr
For me, it comes up because Doxygen makes some use of this feature:
https://www.doxygen.nl/manual/markdown.html#md_header_id
which might be useful for Qt internal docs (e.g. https://contribute.qt-project.org/doc/d7/de2/md_qtdeclarative_2src_2qml_2memory_2design.html comes from a markdown file) , which got me thinking that maybe I'd like to support such a feature in Qt-based editors. (Qt uses md4c) Being able to make links at a finer granularity than the whole page sounds useful (albeit with the usual HTML limitations: not quite fine-grained enough, and needing to explicitly make linkable subsections rather than being able to link to arbitrary parts with no prior planning).
Currently if I write
## Header 2 ## {#header2}
all of the text past the initial ## is part of the heading text. (TBH I don't understand why they want the second ##: I hope that is meant to be optional. Didn't test with PHP so far.)
Class names and custom attributes could be useful too, but I haven't thought that through yet. I want to have support for CSS to directly style markdown in Qt some day, but it's not there yet; if it were there, classes would be useful. Custom attributes... does it harmonize with the use of YAML headers? (which Qt doesn't parse, but you can extract from QTD::frontMatter ), maybe... needs more thought and experimentation.
Of course we shouldn't complicate the C API too much with these features.
This would be a useful feature for setting ids on heading tags.
Without making any changes to the existing API, md4c can already do this, sort of.
md4c will turn markdown like this
## <span id="header2">Header 2</span>
into HTML like this
<h2><span id="header2">Header 2</span></h2>