From ea3ff7aecae73c604e1e976a176f70b11539dde1 Mon Sep 17 00:00:00 2001 From: Kipton Barros Date: Sun, 27 Aug 2023 19:59:36 -0600 Subject: [PATCH] Unescape HTML blocks for notebooks --- docs/src/documenter.md | 10 ++++++++++ src/Literate.jl | 2 ++ 2 files changed, 12 insertions(+) diff --git a/docs/src/documenter.md b/docs/src/documenter.md index fa1477c..72057b9 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 c7fe917..f7c964d 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