Open asbjornu opened 3 years ago
Is there a Ruby version of that tool available?
Not that I've been able to find, no. But I assume it's simple enough to extend the Kramdown::Converter::Html
class and override the necessary methods. We already do that in kramdown-plantuml to add support for PlantUML code.
It's an interesting idea but it presupposes that the HTML would come from Markdown. I'd have to think a bit on how to support such a thing. html-proofer is "source agnostic" and only runs on the HTML files. So such a change (in theory) would have to read the HTML, and the source map, to provide the original Markdown location.
We could make it source agnostic by adding something like this to every HTML document:
<html data-source="../pages/source-markdown.md">
The data-source
attribute would contain the relative path to the source of the generated HTML document, which could be in any format.
If I were to write a plugin to generate something like this for Kramdown and Jekyll, I would probably emit the attributes only when JEKYLL_ENV
is different to production
.
With tools such as markdown-it-source-map it is possible to add source maps in the form of
data-source-line
attributes to generated HTML in order to provide more meaningful error messages from the generated HTML. Is this something HTMLProofer would be OK to add support for?I haven't researched how to get source maps into our Jekyll pipeline, but I suppose it's possible to hook into Kramdown to add this through a Jekyll plugin somehow.
Thoughts?