Skip to content
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

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from

Conversation

dmaljovec
Copy link

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 and end-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 and end-line directives so as not to break backward compatibility. I accomplish this by allowing the user to specify these directives as well as lines, start-before, and end-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 a start-line directive and then place a start-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.

@lkev
Copy link

lkev commented Apr 4, 2020

I would be happy to help out with writing tests, but am in the same position - need a bit of guidance from @miyakogi on how they are currently testing.

Would love to get this implemented!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for end-before and start-after options
2 participants