fredrikekre / Literate.jl

Simple package for literate programming in Julia
https://fredrikekre.github.io/Literate.jl
Other
534 stars 61 forks source link

Remove `@raw html` decorations if target is Jupyter notebook #222

Closed kbarros closed 1 year ago

kbarros commented 1 year ago

In the context of a notebook output, Literate has the helpful behavior that

```math
\int f dx

is replaced with

$$ \int f dx $$


Please consider an additional transformation where
  <tag> ... </tag>

is replaced with just the raw HTML:
...


It appears that Jupyter notebooks follow a Markdown variant where inline HTML tags are explicitly supported: https://daringfireball.net/projects/markdown/syntax#html
fredrikekre commented 1 year ago

I don't see the connection between that link and Jupyters markdown syntax?

Anyway, this would simply require another regex here: https://github.com/fredrikekre/Literate.jl/blob/d59c8c16d45788a7231f6f5ddafb782a531939f5/src/Literate.jl#L184-L185. Do you want to make PR?

kbarros commented 1 year ago

Thanks for the link. I will make a PR.

For future reference, this link discusses the Markdown allowed in a Jupyter notebook: https://nbformat.readthedocs.io/en/latest/markup.html#what-flavor-of-markdown-does-the-notebook-format-support

Most Jupyter Notebook interfaces use the marked.js JavaScript library for rendering markdown. This supports [CommonMark and GitHub flavored Markdown].

Both of these specifications seem to follow the guidelines in the Gruber link, e.g., allow direct inlining of HTML tags.