-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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 support for per-suffix parsers #1747
Add support for per-suffix parsers #1747
Conversation
Override 'read' method in SphinxStandaloneReader to consider the suffix of the file being processed and potentially choose to use a different parser. Add 'parsers' argument to constructor taking a dictionary of suffixes to names of parsers to use for the suffix, as provided by a configuration variable of the same name. This adds the ability to do something like: parsers = {'.md': 'markdown.parsers'} ...to use markdown.parsers.Parser to parse .md files. Note that the custom parser is ONLY used to parse files matching the suffix; otherwise the default (reST) parser is used.
8288ae3
to
cacf381
Compare
LGTM. |
Should be combined with changes from Eric, I think. |
@birkenfeld, can you be more specific? Is this something you would like for me to do? |
I have another fork with more changes that I think build on this PR. I'll have to look at it once I'm home though. |
Here: master...ericholscher:parsers Basically, I'd also like this to work like the |
I guess it's time to release. @birkenfeld any progress? |
Give me the weekend... :) |
Sure! Thanks for your weekend ;) |
I think it works as I'd like it to now. Markdown support can now be done entirely in an extension until we include it in 1.4. |
This adds the ability to do something like
parsers = {'.md': 'markdown.parsers'}
to usemarkdown.parsers.Parser
to parse .md files. Custom parsers specified in this manner are only used to parse files matching the suffix; otherwise the default (reST) parser is used.This should help with #825, by allowing for a mixture of reST and MD.