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

Underline links? #10

Closed
adamalbrecht opened this issue Oct 30, 2020 · 5 comments
Closed

Underline links? #10

adamalbrecht opened this issue Oct 30, 2020 · 5 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@adamalbrecht
Copy link

Is there a way to make <a> tags underlined and blue? If not, it would be nice if this was available to do in markup_option

Thanks!

@codez
Copy link
Collaborator

codez commented Nov 2, 2020

Currently no, but it should be possible to do.

We don't have that many resources for new features, but I'll keep that issue in the backlog. Pull requests are very welcome.

@codez codez added the enhancement New feature or request label May 10, 2021
@codez codez added the good first issue Good for newcomers label Jun 1, 2021
@goulvench
Copy link

Quick workaround:

# Add <u> and <color> inside links to style them as HTML links
your_html.gsub!(/<a ([^>]*)>(.*?)<\/a>/m, "<a \\1><u><color rgb=\"0000FF\">\\2</color></u></a>")

Requires Prawn-Markup 3.0.6 or greater!

@codez Can you outline how you'd see this implemented? I could try sending a PR. As I see it, this would mean adding a link entry in the markup_options hash to allow defining options, then calling start_u and start_color inside start_a (and closing them in order in end_a), and adding tests. Anything else?

@codez
Copy link
Collaborator

codez commented May 18, 2022

Yes, I think that's a good approach. Instead of calling start_u and start_color, I would directly insert the respective tags into the text in start_a and end_a. Like this the code is independent of the parsing methods that work on the stack.

@codez
Copy link
Collaborator

codez commented Nov 1, 2024

Implemented by #53

@codez codez closed this as completed Nov 1, 2024
@goulvench
Copy link

I've moved on from the PDF-heavy project where I needed this a long time ago, but huge thanks to everyone who worked on this feature! 🙏 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants