From cca2c12e52ac9f8ffd97d66438c5157e1fb6524c Mon Sep 17 00:00:00 2001 From: KristofferC Date: Thu, 21 Nov 2019 12:50:24 +0100 Subject: [PATCH] respect semicolon output supression when exporting to Documenter --- src/Literate.jl | 5 +++++ test/runtests.jl | 12 ++++++++++++ 2 files changed, 17 insertions(+) diff --git a/src/Literate.jl b/src/Literate.jl index ecaa06d..1f6b9be 100644 --- a/src/Literate.jl +++ b/src/Literate.jl @@ -408,8 +408,13 @@ function markdown(inputfile, outputdir; preprocess = identity, postprocess = ide write(iomd, "; continued = true") end write(iomd, '\n') + last_line = "" for line in chunk.lines write(iomd, line, '\n') + last_line = line + end + if documenter && REPL.ends_with_semicolon(last_line) + write(iomd, "nothing #hide\n") end write(iomd, codefence.second, '\n') end diff --git a/test/runtests.jl b/test/runtests.jl index 75dca4f..4051dcc 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -221,6 +221,9 @@ content = """ ## Indented comment end + # Semicolon output supression + 1 + 1; + #nb # A notebook cell with special metadata #nb %% Meta1 {"meta": "data"} #nb 1+1 @@ -279,6 +282,8 @@ const expansion_warning = get(ENV, "HAS_JOSH_K_SEAL_OF_APPROVAL", "") == "true" # Indented comment end + 1 + 1; + # This file was generated using Literate.jl, https://github.com/fredrikekre/Literate.jl """ @@ -458,6 +463,13 @@ end end ``` + Semicolon output supression + + ```@example inputfile + 1 + 1; + nothing #hide + ``` + *This page was generated using [Literate.jl](https://github.com/fredrikekre/Literate.jl).* """