-
Notifications
You must be signed in to change notification settings - Fork 21
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
feat: add support for test renderer, running doctests #109
Conversation
feab951
to
faf5935
Compare
I did a quick test. I cloned the repo, checked out the commit in this PR, and then updated my I think this might be a breaking change with respect to semvar, but I'm hardly an expert. You could introduce a configuration switch like this. [preprocessor.admonish]
renderers = ["html", "test"] I copied that example from the configuration I see for But I'm happy with this as is. |
That's an excellent idea. I'll add a renderer option in the next minor version, and add a note to enable it by default for next major version |
Thanks for looking into this. I really appreciate it (and I really appreciate |
faf5935
to
9361b7e
Compare
I ended up restructuring a bit to make the approach more extensible and testable - lots of refactoring that's only interesting to me, but the upshot is you can now add: [preprocessor.admonish.renderer.test]
render_mode = "strip" And it will enable the You can test this by simply enabling the same setting for the [preprocessor.admonish.renderer.html]
render_mode = "strip" I have a few more bits of documentation to tidy up, but I'll put out a minor release with this in asap |
Closes #108
Adds support for the
test
renderer used bymdbook test
to run doctests.This required implementing a new method to simply strip all
admonish
syntax after relevant blocks are identified and parsed, leaving behind the content (basically in an "unwrapped" form)This should not be a breaking change, as all block content is subject to further rendering from the markdown engine anyway in the standard
html
render pipeline. However, this will definitely be a minor/feature release. It could technically be breaking if tests that were previously undetected now fail, but I'd argue that's a bugfix.@stevecheckoway open for comments on if this fits your use case, and if you think there are any other details I've missed