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

autolinks should have a class when converted to html #1501

Closed
ousia opened this issue Aug 8, 2014 · 7 comments
Closed

autolinks should have a class when converted to html #1501

ousia opened this issue Aug 8, 2014 · 7 comments

Comments

@ousia
Copy link
Contributor

ousia commented Aug 8, 2014

Autolinks should add a class (such as class="autolink") when converted to html, so it would be possible to format them in a different way than links in standard text.

Here you have a minimal sample (and its output):

<http://www.autolink.com> and [standard link](http://www.link.com)

So it would to be possible to format them in CSS with:

a.autolink  { font-family: monospace; }

If the class isn’t added for autolinks, standard text would be formated to monospace when containing links.

Many thanks for your excellent work.

@jgm
Copy link
Owner

jgm commented Aug 9, 2014

I agree that this would be helpful. But with the current Pandoc AST, it isn't always obvious when you have an autolink -- autolinks are represented the same way as ordinary links. You'd have to compare an [Inline] to a String, and there might be differences due to URL escaping. Possibly in the future we should have a separate Inline element Autolink.

@jgm
Copy link
Owner

jgm commented Aug 9, 2014

For now you can probably write a tiny bit of javascript to look for links whose contents match their href attributes and add a class.

@ousia
Copy link
Contributor Author

ousia commented Aug 10, 2014

Sorry, but I wonder whether the approach to fix #1270 would make sense here.

@jgm
Copy link
Owner

jgm commented Aug 10, 2014

Hm, maybe it's that simple.

+  let isAutolink = txt == [Str src]

I'll have to check the markdown reader to make sure that's reliable.

@ousia
Copy link
Contributor Author

ousia commented Aug 12, 2014

@jgm, could the new code (once tested) be included in next release?

@jgm
Copy link
Owner

jgm commented Aug 12, 2014

I think we can squeeze it in.
+++ Pablo Rodríguez [Aug 12 14 13:34 ]:

[1]@jgm, could the new code (once tested) be included in next release?


Reply to this email directly or [2]view it on GitHub.

References

  1. https://github.com/jgm
  2. autolinks should have a class when converted to html #1501 (comment)

@jgm jgm closed this as completed in 81157c7 Aug 12, 2014
@ousia
Copy link
Contributor Author

ousia commented Aug 13, 2014

Many thanks for the fix.

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