Created
January 5, 2024 15:16
-
-
Save mzagaja/43eff4ac94a178a81b0f3929a674f1a2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'yard' | |
# Template helper to modify processing of links in HTML generated from our | |
# markdown files. | |
module LocalLinkHelper | |
# Rewrites links to (assumed local) markdown files so they're processed as | |
# {file: } directives. | |
def resolve_links(text) | |
text = text.gsub(%r{<a href="([^"]*).md">([^<]*)</a>}, '{file:\1.html \2}') | |
super text | |
end | |
end | |
YARD::Templates::Template.extra_includes << LocalLinkHelper |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment