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
jupytext.jupytext.read and jupytext.jupytext.write don't perfectly roundtrip #993
Comments
Looks like I just need to add:
|
Thank you @MarcoGorelli for documenting this! This is very helpful. |
Reckon |
This might be more user friendly indeed. @chrisjsewell what is your opinion on this ? |
Just FYI, my use-case would be to support running linters/formatters directly on jupytext .md files (nbQA-dev/nbQA#745 ) For now I'll get around it with # get lexer: see https://github.com/mwouts/jupytext/issues/993
parser = MarkdownIt("commonmark").disable("inline", True)
parsed = parser.parse(content)
lexer = None
for token in parsed:
if token.type == "fence" and token.info.startswith("{code-cell}"):
lexer = remove_prefix(token.info, "{code-cell}").strip()
md_content["metadata"]["language_info"] = {"pygments_lexer": lexer}
break |
Example:
t.md
with the following:Then, if I open
t_new.md
, it's exactly the same ast.md
, but it has:instead of
Is there a way to round-trip a file such that it retains these directives?
Versions:
The text was updated successfully, but these errors were encountered: