diff --git a/docs/src/documenter.md b/docs/src/documenter.md index fa1477cc..72057b95 100644 --- a/docs/src/documenter.md +++ b/docs/src/documenter.md @@ -45,6 +45,16 @@ if we set `documenter = true`: \int f dx $$ ``` +- Whereas Documenter requires HTML blocks to be escaped + ```` + ```@raw html + ... + ``` + ```` + the output to a notebook markdown cell will be raw HTML + ``` + ... + ``` ### [`Literate.script`](@ref): - Documenter style `@ref`s and `@id` will be removed. This means that you can use diff --git a/src/Literate.jl b/src/Literate.jl index c7fe9179..f7c964d6 100644 --- a/src/Literate.jl +++ b/src/Literate.jl @@ -184,6 +184,8 @@ function replace_default(content, sym; # Replace Markdown stdlib math environments push!(repls, r"```math(.*?)```"s => s"$$\1$$") push!(repls, r"(? s"$\1$") + # Remove Documenter escape sequence around HTML + push!(repls, r"```@raw(\h+)html(.*?)```"s => s"\2") else # sym === :jl push!(repls, r"^#(!md|!nb|jl) "m => "") # remove leading #!md, #!nb, and #jl push!(repls, r" #(!md|!nb|jl)$"m => "") # remove trailing #!md, #!nb, and #jl diff --git a/test/runtests.jl b/test/runtests.jl index 5970b060..2e5894ab 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -234,6 +234,11 @@ content = """ ## Indented comment end + # Some inline html + # ```@raw html + # Literate.jl + # ``` + # Semicolon output supression 1 + 1; @@ -600,6 +605,11 @@ end end end ```` + Some inline html + ```@raw html + Literate.jl + ``` + Semicolon output supression ````@example inputfile @@ -1025,6 +1035,14 @@ end end ] """, + """ + "source": [ + "Some inline html\\n", + "\\n", + " Literate.jl" + ] + """, + """ "metadata": { "meta": "data"