-
-
Notifications
You must be signed in to change notification settings - Fork 5
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
Ignore fenced code blocks #6
Conversation
More testing:
|
Hello, thanks! At the moment I am working on the TOC list indentation problem because it was something I left behind for a long time. There is also the fact that GitLab changed markdown parser in the past year:
Yes, tests are mandatory for md_toc. The API changed (and it is still changing) in the
Maybe it's possible to move the code fence detection part of your code to a new function, something like
I didn't know about this but I'll certainly look into it. |
👍 Splitting the code fence detection to two functions makes sense- one to detect the opening, and another to detect the closing. There is still state tracking that remains untested, but that's an easy way to both increase the test coverage and reduce the complexity of the main parser. |
Great, thanks! |
Merged in the |
Thanks for this useful tool! Here's a first pass at ignoring fenced code blocks as defined in the GFM spec. Fixes #4
I'd like to contribute tests for this, but the
build_toc()
function is currently somewhat difficult to test because it can only take input from files. I propose a change to the api to provide abuild_toc_from_string()
function which takes the markdown content as a string. Alternatively, I can add a bunch of test case markdown files to the repo. Let me know what approach you prefer.For now, a brief manual test:
When I ran
make pep
on master it changed a bunch of files, so I decided not to runmake pep
to keep the diff small. It would be helpful to include arequirements.txt
file with pinned versions of tools like yapf and flake8. I know that flake8 changes its behavior quite a bit with each release.