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

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

Open
athompso opened this issue Dec 7, 2024 · 1 comment

Comments

@athompso
Copy link

athompso commented Dec 7, 2024

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.

@kristapsdz
Copy link
Owner

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.

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

No branches or pull requests

2 participants