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
Support headings in RST to MD #723
Conversation
This enables support for converting headings from RST into Markdown text for Jupyter Notebooks, with heading levels maintained for entire notebook.
Codecov Report
@@ Coverage Diff @@
## master #723 +/- ##
==========================================
+ Coverage 97.47% 97.49% +0.01%
==========================================
Files 32 32
Lines 3560 3587 +27
==========================================
+ Hits 3470 3497 +27
Misses 90 90
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would be useful. I just have some nitpicks. Would be good for someone else to review as this was complicated!
sphinx_gallery/notebook.py
Outdated
r'(?P<pre>\A|^[ \t]*\n)' # Start of string or blank line above | ||
r'(?:(?P<over>[{0}])(?P=over)*\n[ \t]*)?' # Over, with heading space | ||
r'(?P<heading>\S[^\n]*)\n' # Heading itself | ||
r'(?P<under>(?(over)(?P=over)|[{0}]))(?P=under)*$' # if over make same |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'if over matched, make same' ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was battling with flake8 here a bit. Maybe I should interweave comments, or add flake8 ignore?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, adding # noqa E501
to the end of the line (after the comment) fixes it. It looks messy but I think its okay (unless @larsoner objects)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I decided to interweave the comments with the regular expression, as I thought it worked out better and allowed more verbose comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks that's clearer. Will help when we look back at this regex!
[ci skip] Co-authored-by: Lucy Liu <jliu176@gmail.com>
[ci skip] Co-authored-by: Lucy Liu <jliu176@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lucyleeow feel free to merge if you're happy
Thanks @sdhiscocks |
This enables support for converting headings from RST into Markdown text for Jupyter Notebooks, with heading levels maintained for entire notebook.