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

Easy way to replace links to other markdown files to html files #528

Open
sturmf opened this issue Sep 1, 2023 · 3 comments
Open

Easy way to replace links to other markdown files to html files #528

sturmf opened this issue Sep 1, 2023 · 3 comments

Comments

@sturmf
Copy link

sturmf commented Sep 1, 2023

I might be missing something obvious but I have several markdown files that have links between them.
After conversion to html the links still point to *.md files. If the extension would have been changed to *.html then they would work.
So I am wondering if I am missing something obvious to make this change happen?

@Crozzers
Copy link
Contributor

Crozzers commented Sep 3, 2023

There isn't a dedicated option for this but you can achieve the same effect using the link patterns extra

@sturmf
Copy link
Author

sturmf commented Sep 3, 2023

Thanks for the info but I utterly failed using that feature 😭 I just haven't really wrapped my brain around how that one works.

For now I am postprocessing the generated html which is fine. But I am still striving for a more elegant solution.

@Crozzers
Copy link
Contributor

Crozzers commented Sep 5, 2023

The link patterns extra doesn't match against URLs, it matches against plain text, which caught me off guard when I used it.
I believe it was designed for snippets like this:

blah blah related to #12345 from the issue tracker

Where you could then have a regex to match these refs and replace them with links to your issue tracker.

Since you've got links to markdown files, you'll have to match your links, including the markdown link syntax (eg: \[.*\]\(.*\.md\) and replace them with your custom <a> tag.


In the future, I think it would be nice to implement this as a custom extra (#519), in the way this comment describes, but that does require the custom extra infrastructure.

@Crozzers Crozzers mentioned this issue Jan 3, 2024
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