lowdown icon indicating copy to clipboard operation
lowdown copied to clipboard

Feature Request: add ability to specify metadata on HTML links, e.g. "rel=external" without using raw HTML links

Open athompso opened this issue 1 year ago • 1 comments

There does not appear to be any way to turn (this is not actual working syntax): words (title)[link]{rel=external} more words into: words <a rel="external" href="link">title</a> more words

Specifying the href by hand works, if I do: words <a rel="external" href="link>title</a> more words that generates, er... words <a rel="external" href="link>title</a> more words in the HTML, but that seems to go against the spirit of why lowdown exists (agnostic input, multi-format output).

In this case, our CSS uses the rel=external attribute to automatically place an "external link" arrow in the title, which we find valuable. Any suggestions? Best I've come up with is to do [title🔗] which works but is a PITA for many reasons including semantic dilution.

athompso avatar Dec 07 '24 17:12 athompso

parse_ext_attrs is the place one would look at to add this. If you'd like to take a stab at this, I'd refactor any key=value pair as being added to a list in rndr_image, rndr_link, and other attribute consumers. Right now, the recognised ones (width and height) are hard-coded into the header file. This way, the front-ends (e.g., HTML) can handle arbitrary attributes as they see fit. For example, width for images and rel for links. With any remaining ones, pandoc renders them as data-xxx, which looks correct to me.

kristapsdz avatar Dec 07 '24 18:12 kristapsdz