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

Monkey patch ToHtmlCrossref to modify ref links #297

Merged
merged 1 commit into from
Sep 1, 2023

Conversation

jonathanhefner
Copy link
Member

Prior to this commit, postprocessing was used to unlink unintentional ref links and style unstyled code ref links. Postprocessing only affects the final generator output, which is generally more robust. But in these cases, it would be more consistent for intermediate consumers of RDoc::CodeObject#description to also see these changes.

This commit instead monkey patches RDoc::Markup::ToHtmlCrossref so that it returns bare text for unintentional ref links and wraps unstyled code ref links with <code></code>. Monkey patching RDoc is not ideal, but it allows all consumers of RDoc::CodeObject#description to see these changes.

Prior to this commit, postprocessing was used to unlink unintentional
ref links and style unstyled code ref links.  Postprocessing only
affects the final generator output, which is generally more robust.  But
in these cases, it would be more consistent for intermediate consumers
of `RDoc::CodeObject#description` to also see these changes.

This commit instead monkey patches `RDoc::Markup::ToHtmlCrossref` so
that it returns bare text for unintentional ref links and wraps
unstyled code ref links with `<code></code>`.  Monkey patching RDoc is
not ideal, but it allows all consumers of `RDoc::CodeObject#description`
to see these changes.
@jonathanhefner jonathanhefner merged commit 671db85 into rails:main Sep 1, 2023
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.

1 participant