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

Add MarkdownFileLinks extra (#528) #617

Merged
merged 9 commits into from
Jan 31, 2025

Conversation

Crozzers
Copy link
Contributor

This PR closes #528 by adding an extra that converts .md links to .html links. I've also spun the link processing logic out into a LinkProcessor extra, which can be subclassed and re-used just like the ItalicAndBoldProcessor.

LinkProcessor

This new extra contains all of the link processing logic, allowing new extras to piggy-back off of it and manipulate links without having to re-implement the syntax matching themselves.

The class allows subclasses to filter which links they wish to process (inline/reference and anchor/image).

MarkdownFileLinks

Simply replaces .md links with .html. Also works for link definitions, although this can be turned off using the extra's options. EG: markdown(..., extras={'markdown-file-links': {'link_defs': False}})

@nicholasserra
Copy link
Collaborator

Awesome, thanks for fixing the pygments error too!

@nicholasserra nicholasserra merged commit b1c26b2 into trentm:master Jan 31, 2025
15 checks passed
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.

Easy way to replace links to other markdown files to html files
2 participants