This repository has been archived by the owner on Nov 17, 2022. It is now read-only.
Adding support for sphinx-style directives on mdinclude #42
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #39
Hi, great project! I made an attempt to address the issue linked above without breaking the existing functionality. Please note, I did not add any tests yet for this PR as I wasn't sure how you were testing the existing
start-line
andend-line
directives, but I would be happy to add tests with a bit more direction.The purpose of this PR is to allow users such as myself to include parts of markdown files based on the same syntax that sphinx uses for its literalinclude.
I took some effort to not disrupt the existing
start-line
andend-line
directives so as not to break backward compatibility. I accomplish this by allowing the user to specify these directives as well aslines
,start-before
, andend-after
. The end result is to take the intersection of all of these directives. For a simple example, if you ask to start on line 5 with astart-line
directive and then place astart-after
that first matches line 10, then the lines 5-9 will not be included in the output. I can provide more examples if this is not clear.Please let me know if there are any changes I can do to make this code more compatible with the rest of the project including testing, documentation, appropriate styling (sorry, my IDE made some whitespace changes it looks like), etc.