Skip to content

Inspector: make clickable URL's #82

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Inspector: make clickable URL's #82

wants to merge 4 commits into from

Conversation

dfalbel
Copy link
Collaborator

@dfalbel dfalbel commented Jul 14, 2025

Make urls clickable if they are not correctly rendered when casting markdown to HTML.

Some webpages do insert <a> tags inside <code> blocks. While this is valid HTML, there's no direct supported Markdown conversion. This PR, converts any URL into a clickable link so the inspector can use it.

tryCatch(
{
text <- as.character(node)
text <- stringr::str_replace_all(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We only have stringr in suggests. Can we please use stringi or base R here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in f2d5364

xml2::read_html(html_preview)

html_preview |>
xml2::xml_find_all(".//*[not(*)]") |>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to protect against text that is a link already, under an a tag?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<a href="https://github.com">https://github.com<a/>

will become

<a href="https://github.com"><a href="https://github.com">https://github.com<a/><a/>

which is not an issue for this case.

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

Successfully merging this pull request may close these issues.

2 participants