-
Notifications
You must be signed in to change notification settings - Fork 574
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
Add @mgeier's math tagging for rst conversion[WIP] #416
base: main
Are you sure you want to change the base?
Conversation
Is there a reason that our pandoc calls inside filters don't include |
Aha…it's because we don't use that at all because our pandoc call is structured slightly differently than nbsphinx's, which has a two step call one to go to json and then a second to convert from json to whichever format is needed. This will take a little more work than I thought, changing to WIP. |
Hmmm…one solution would be to perform the intermediate |
nbconvert/filters/markdown.py
Outdated
@@ -102,4 +102,4 @@ def rawlatex2math(text): | |||
json_data = json.loads(text, object_hook=rawlatex2math_hook) | |||
return json.dumps(json_data) | |||
|
|||
return pandoc(source, 'markdown', 'rst', extra_args=extra_args) | |||
return pandoc(source, 'markdown', 'rst', extra_args=extra_args, filter_func=rawlatex2math) |
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 doesn't have def to refer back to as far as I can tell. no wonder it doesn't work.
c5b30ad
to
d1993ab
Compare
nbconvert/filters/markdown.py
Outdated
@@ -117,5 +117,7 @@ def rawlatex2math_hook(obj): | |||
def rawlatex2math(text): | |||
json_data = json.loads(text, object_hook=rawlatex2math_hook) | |||
return json.dumps(json_data) | |||
|
|||
temp_text = |
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 is invalid :(
This is going the wrong direction, fix using the new syntax for intermediate actions on the json internals as a pure python process. |
In particular note: these results associated with #458 |
Make pandoc call include filter trying to have a secondary two processing level pandoc call
return json.dumps(json_data) | ||
|
||
|
||
return convert_pandoc(source, 'markdown', 'rst', extra_args=extra_args) |
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.
Did you mean to use the new pandoc_with_filter
function you defined here? At the moment, I don't think it's using the functions functions you define above.
Should address #291.
Some note on review: I just copied that code as it was used in production with nbsphinx. It LGTM, but I've not put it through more extensive testing; I'm assuming that (if it doesn't break our tests) then it does as @mgeier describes in #291 and alludes to in #232.