diff --git a/.github/dependabot.yml b/.github/dependabot.yml
new file mode 100644
index 0000000..d60f070
--- /dev/null
+++ b/.github/dependabot.yml
@@ -0,0 +1,7 @@
+# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
+version: 2
+updates:
+ - package-ecosystem: "github-actions"
+ directory: "/" # Location of package manifests
+ schedule:
+ interval: "monthly"
diff --git a/.github/workflows/TagBot.yml b/.github/workflows/TagBot.yml
index f49313b..6e27469 100644
--- a/.github/workflows/TagBot.yml
+++ b/.github/workflows/TagBot.yml
@@ -11,5 +11,15 @@ jobs:
steps:
- uses: JuliaRegistries/TagBot@v1
with:
+ changelog: |
+ {% if custom %}
+ {{ custom }}
+ {% endif %}
+
+ See [`CHANGELOG.md`](https://github.com/fredrikekre/Literate.jl/blob/master/CHANGELOG.md) for notable changes.
+
+ {% if previous_release %}
+ [Diff since {{ previous_release }}]({{ compare_url }})
+ {% endif %}
token: ${{ secrets.GITHUB_TOKEN }}
ssh: ${{ secrets.DOCUMENTER_KEY }}
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 315c305..51a7380 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -15,7 +15,7 @@ jobs:
strategy:
matrix:
version:
- - '1.0'
+ - '1.6'
- '1'
- 'nightly'
os:
@@ -26,7 +26,7 @@ jobs:
- os: macOS-latest
version: '1'
steps:
- - uses: actions/checkout@v2
+ - uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v1
with:
version: ${{ matrix.version }}
@@ -39,14 +39,14 @@ jobs:
key: .julia-test-${{ matrix.version }}-${{ hashFiles('Project.toml') }}
- uses: julia-actions/julia-runtest@v1
- uses: julia-actions/julia-processcoverage@v1
- - uses: codecov/codecov-action@v1
+ - uses: codecov/codecov-action@v3
with:
file: lcov.info
docs:
name: Documentation
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v2
+ - uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v1
with:
version: '1'
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 920e015..d004c61 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,33 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
+## [2.16.0] - 2023-11-08
+### Added
+- "Soft" scoping rules (see e.g. https://github.com/JuliaLang/SoftGlobalScope.jl) are now
+ available for code execution (markdown and notebook output). This is enabled by default
+ for Jupyter notebook output (to mimic how the IJulia kernel works), and disabled
+ otherwise. Soft scope rules can be enabled/disabled with the `softscope :: Bool`
+ configuration variable. ([#227][github-227], [#230][github-230])
+### Changed
+- The minimum Julia version requirement for Literate >= 2.16.0 is now 1.6.0 (from 1.0.0).
+ ([#230][github-230])
+
+## [2.15.1] - 2023-11-08
+### Fixed
+- Fix a bug where `Literate.markdown` with `execute=true` would (try to) output images in
+ the wrong directory. This only occured when passing a relative output directory.
+ ([#228][github-228], [#229][github-229])
+
+## [2.15.0] - 2023-09-05
+### Added
+- Documenter style `@raw html` blocks are automatically handled in Jupyter notebook output
+ (similar to how Documenter style ` ```math ` blocks are rewritten to `$$` blocks).
+ ([#222][github-222], [#223][github-223])
+
+## [2.14.2] - 2023-08-28
+### Fixed
+- Remove double newline in `Literate.script` output. ([#221][github-221])
+
## [2.14.1] - 2023-08-04
### Fixed
- Update generated `EditURL` to use a relative path instead and let Documenter figure out
@@ -247,8 +274,19 @@ https://discourse.julialang.org/t/ann-literate-jl/10651 for release announcement
[github-204]: https://github.com/fredrikekre/Literate.jl/issues/204
[github-205]: https://github.com/fredrikekre/Literate.jl/pull/205
[github-219]: https://github.com/fredrikekre/Literate.jl/pull/219
-
-[Unreleased]: https://github.com/fredrikekre/Literate.jl/compare/v2.14.1...HEAD
+[github-221]: https://github.com/fredrikekre/Literate.jl/pull/221
+[github-222]: https://github.com/fredrikekre/Literate.jl/issues/222
+[github-223]: https://github.com/fredrikekre/Literate.jl/pull/223
+[github-227]: https://github.com/fredrikekre/Literate.jl/issues/227
+[github-228]: https://github.com/fredrikekre/Literate.jl/issues/228
+[github-229]: https://github.com/fredrikekre/Literate.jl/pull/229
+[github-230]: https://github.com/fredrikekre/Literate.jl/pull/230
+
+[Unreleased]: https://github.com/fredrikekre/Literate.jl/compare/v2.16.0...HEAD
+[2.16.0]: https://github.com/fredrikekre/Literate.jl/compare/v2.15.1...v2.16.0
+[2.15.1]: https://github.com/fredrikekre/Literate.jl/compare/v2.15.0...v2.15.1
+[2.15.0]: https://github.com/fredrikekre/Literate.jl/compare/v2.14.2...v2.15.0
+[2.14.2]: https://github.com/fredrikekre/Literate.jl/compare/v2.14.1...v2.14.2
[2.14.1]: https://github.com/fredrikekre/Literate.jl/compare/v2.14.0...v2.14.1
[2.14.0]: https://github.com/fredrikekre/Literate.jl/compare/v2.13.3...v2.14.0
[2.13.4]: https://github.com/fredrikekre/Literate.jl/compare/v2.13.3...v2.13.4
diff --git a/Project.toml b/Project.toml
index 83dc6a3..c869e9e 100644
--- a/Project.toml
+++ b/Project.toml
@@ -1,6 +1,6 @@
name = "Literate"
uuid = "98b081ad-f1c9-55d3-8b20-4c87d4299306"
-version = "2.14.1"
+version = "2.16.0"
[deps]
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
@@ -9,9 +9,11 @@ JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
REPL = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb"
[compat]
+Base64 = "1"
IOCapture = "0.2"
JSON = "0.18, 0.19, 0.20, 0.21, 1"
-julia = "1"
+REPL = "1"
+julia = "1.6"
[extras]
DisplayAs = "0b91fe84-8a4c-11e9-3e1d-67c38462b6d6"
diff --git a/docs/Manifest.toml b/docs/Manifest.toml
index 2750ce1..16e04cc 100644
--- a/docs/Manifest.toml
+++ b/docs/Manifest.toml
@@ -39,15 +39,15 @@ version = "1.16.1+1"
[[CodecZlib]]
deps = ["TranscodingStreams", "Zlib_jll"]
-git-tree-sha1 = "02aa26a4cf76381be7f66e020a3eddeb27b0a092"
+git-tree-sha1 = "cd67fc487743b2f0fd4380d4cbd3a24660d0eec8"
uuid = "944b1d66-785c-5afd-91f1-9de20f533193"
-version = "0.7.2"
+version = "0.7.3"
[[ColorSchemes]]
deps = ["ColorTypes", "ColorVectorSpace", "Colors", "FixedPointNumbers", "PrecompileTools", "Random"]
-git-tree-sha1 = "dd3000d954d483c1aad05fe1eb9e6a715c97013e"
+git-tree-sha1 = "67c1f244b991cad9b0aa4b7540fb758c2488b129"
uuid = "35d6a980-a343-548e-a6ea-1d62b119f2f4"
-version = "3.22.0"
+version = "3.24.0"
[[ColorTypes]]
deps = ["FixedPointNumbers", "Random"]
@@ -75,9 +75,9 @@ version = "0.12.10"
[[Compat]]
deps = ["UUIDs"]
-git-tree-sha1 = "e460f044ca8b99be31d35fe54fc33a5c33dd8ed7"
+git-tree-sha1 = "8a62af3e248a8c4bad6b32cbbe663ae02275e32c"
uuid = "34da2185-b29b-5c13-b0c7-acf172513d20"
-version = "4.9.0"
+version = "4.10.0"
weakdeps = ["Dates", "LinearAlgebra"]
[Compat.extensions]
@@ -90,9 +90,9 @@ version = "1.0.5+0"
[[ConcurrentUtilities]]
deps = ["Serialization", "Sockets"]
-git-tree-sha1 = "5372dbbf8f0bdb8c700db5367132925c0771ef7e"
+git-tree-sha1 = "8cfa272e8bdedfa88b6aefbbca7c19f1befac519"
uuid = "f0e56b4a-5159-44fe-b623-3e5288b988bb"
-version = "2.2.1"
+version = "2.3.0"
[[Contour]]
git-tree-sha1 = "d05d9e7b7aedff4e5b51a029dced05cfb6125781"
@@ -127,18 +127,24 @@ uuid = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
version = "0.9.3"
[[Documenter]]
-deps = ["ANSIColoredPrinters", "AbstractTrees", "Base64", "Dates", "DocStringExtensions", "IOCapture", "InteractiveUtils", "JSON", "LibGit2", "Logging", "Markdown", "MarkdownAST", "PrecompileTools", "REPL", "Test", "Unicode"]
-git-tree-sha1 = "34e4566ad9f151fcc9a9a9c1868b2dc865fa195c"
+deps = ["ANSIColoredPrinters", "AbstractTrees", "Base64", "Dates", "DocStringExtensions", "Downloads", "IOCapture", "InteractiveUtils", "JSON", "LibGit2", "Logging", "Markdown", "MarkdownAST", "Pkg", "PrecompileTools", "REPL", "RegistryInstances", "SHA", "Test", "Unicode"]
+git-tree-sha1 = "ad7d14c9ab91014ed8837d79c09aa6af83b965d7"
repo-rev = "master"
repo-url = "https://github.com/JuliaDocs/Documenter.jl.git"
uuid = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
-version = "0.28.0-DEV"
+version = "1.1.2"
[[Downloads]]
deps = ["ArgTools", "FileWatching", "LibCURL", "NetworkOptions"]
uuid = "f43a241f-c20a-4ad4-852c-f6b1247861c6"
version = "1.6.0"
+[[EpollShim_jll]]
+deps = ["Artifacts", "JLLWrappers", "Libdl"]
+git-tree-sha1 = "8e9441ee83492030ace98f9789a654a6d0b1f643"
+uuid = "2702e6a9-849d-5ed8-8c21-79e8b8f9ee43"
+version = "0.0.20230411+0"
+
[[ExceptionUnwrapping]]
deps = ["Test"]
git-tree-sha1 = "e90caa41f5a86296e014e148ee061bd6c3edec96"
@@ -158,10 +164,10 @@ uuid = "c87230d0-a227-11e9-1b43-d7ebe4e7570a"
version = "0.4.1"
[[FFMPEG_jll]]
-deps = ["Artifacts", "Bzip2_jll", "FreeType2_jll", "FriBidi_jll", "JLLWrappers", "LAME_jll", "Libdl", "Ogg_jll", "OpenSSL_jll", "Opus_jll", "PCRE2_jll", "Pkg", "Zlib_jll", "libaom_jll", "libass_jll", "libfdk_aac_jll", "libvorbis_jll", "x264_jll", "x265_jll"]
-git-tree-sha1 = "74faea50c1d007c85837327f6775bea60b5492dd"
+deps = ["Artifacts", "Bzip2_jll", "FreeType2_jll", "FriBidi_jll", "JLLWrappers", "LAME_jll", "Libdl", "Ogg_jll", "OpenSSL_jll", "Opus_jll", "PCRE2_jll", "Zlib_jll", "libaom_jll", "libass_jll", "libfdk_aac_jll", "libvorbis_jll", "x264_jll", "x265_jll"]
+git-tree-sha1 = "466d45dc38e15794ec7d5d63ec03d776a9aff36e"
uuid = "b22a6f82-2f65-5046-a5b2-351ab43fb4e5"
-version = "4.4.2+2"
+version = "4.4.4+1"
[[FileWatching]]
uuid = "7b1f6079-737a-58dc-b8bc-7a2ca5c1b5ee"
@@ -204,15 +210,15 @@ version = "3.3.8+0"
[[GR]]
deps = ["Artifacts", "Base64", "DelimitedFiles", "Downloads", "GR_jll", "HTTP", "JSON", "Libdl", "LinearAlgebra", "Pkg", "Preferences", "Printf", "Random", "Serialization", "Sockets", "TOML", "Tar", "Test", "UUIDs", "p7zip_jll"]
-git-tree-sha1 = "d73afa4a2bb9de56077242d98cf763074ab9a970"
+git-tree-sha1 = "27442171f28c952804dede8ff72828a96f2bfc1f"
uuid = "28b8d3ca-fb5f-59d9-8090-bfdbd6d07a71"
-version = "0.72.9"
+version = "0.72.10"
[[GR_jll]]
-deps = ["Artifacts", "Bzip2_jll", "Cairo_jll", "FFMPEG_jll", "Fontconfig_jll", "GLFW_jll", "JLLWrappers", "JpegTurbo_jll", "Libdl", "Libtiff_jll", "Pixman_jll", "Qt6Base_jll", "Zlib_jll", "libpng_jll"]
-git-tree-sha1 = "f61f768bf090d97c532d24b64e07b237e9bb7b6b"
+deps = ["Artifacts", "Bzip2_jll", "Cairo_jll", "FFMPEG_jll", "Fontconfig_jll", "FreeType2_jll", "GLFW_jll", "JLLWrappers", "JpegTurbo_jll", "Libdl", "Libtiff_jll", "Pixman_jll", "Qt6Base_jll", "Zlib_jll", "libpng_jll"]
+git-tree-sha1 = "025d171a2847f616becc0f84c8dc62fe18f0f6dd"
uuid = "d2c73de3-f751-5644-a686-071e5b155ba9"
-version = "0.72.9+0"
+version = "0.72.10+0"
[[Gettext_jll]]
deps = ["Artifacts", "CompilerSupportLibraries_jll", "JLLWrappers", "Libdl", "Libiconv_jll", "Pkg", "XML2_jll"]
@@ -221,10 +227,10 @@ uuid = "78b55507-aeef-58d4-861c-77aaff3498b1"
version = "0.21.0+0"
[[Glib_jll]]
-deps = ["Artifacts", "Gettext_jll", "JLLWrappers", "Libdl", "Libffi_jll", "Libiconv_jll", "Libmount_jll", "PCRE2_jll", "Pkg", "Zlib_jll"]
-git-tree-sha1 = "d3b3624125c1474292d0d8ed0f65554ac37ddb23"
+deps = ["Artifacts", "Gettext_jll", "JLLWrappers", "Libdl", "Libffi_jll", "Libiconv_jll", "Libmount_jll", "PCRE2_jll", "Zlib_jll"]
+git-tree-sha1 = "e94c92c7bf4819685eb80186d51c43e71d4afa17"
uuid = "7746bdde-850d-59dc-9ae8-88ece973131d"
-version = "2.74.0+2"
+version = "2.76.5+0"
[[Graphite2_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
@@ -239,9 +245,9 @@ version = "1.0.2"
[[HTTP]]
deps = ["Base64", "CodecZlib", "ConcurrentUtilities", "Dates", "ExceptionUnwrapping", "Logging", "LoggingExtras", "MbedTLS", "NetworkOptions", "OpenSSL", "Random", "SimpleBufferStream", "Sockets", "URIs", "UUIDs"]
-git-tree-sha1 = "cb56ccdd481c0dd7f975ad2b3b62d9eda088f7e2"
+git-tree-sha1 = "5eab648309e2e060198b45820af1a37182de3cce"
uuid = "cd3eb016-35fb-5094-929b-558a96fad6f3"
-version = "1.9.14"
+version = "1.10.0"
[[HarfBuzz_jll]]
deps = ["Artifacts", "Cairo_jll", "Fontconfig_jll", "FreeType2_jll", "Glib_jll", "Graphite2_jll", "JLLWrappers", "Libdl", "Libffi_jll", "Pkg"]
@@ -266,15 +272,15 @@ version = "0.2.2"
[[JLFzf]]
deps = ["Pipe", "REPL", "Random", "fzf_jll"]
-git-tree-sha1 = "f377670cda23b6b7c1c0b3893e37451c5c1a2185"
+git-tree-sha1 = "9fb0b890adab1c0a4a475d4210d51f228bfc250d"
uuid = "1019f520-868f-41f5-a6de-eb00f4b6a39c"
-version = "0.1.5"
+version = "0.1.6"
[[JLLWrappers]]
-deps = ["Preferences"]
-git-tree-sha1 = "abc9885a7ca2052a736a600f7fa66209f96506e1"
+deps = ["Artifacts", "Preferences"]
+git-tree-sha1 = "7e5d6779a1e09a36db2a7b6cff50942a0a7d0fca"
uuid = "692b3bcd-3c85-4b1f-b108-f13ce0eb3210"
-version = "1.4.1"
+version = "1.5.0"
[[JSON]]
deps = ["Dates", "Mmap", "Parsers", "Unicode"]
@@ -313,9 +319,9 @@ uuid = "dd4b983a-f0e5-5f8d-a1b7-129d4a5fb1ac"
version = "2.10.1+0"
[[LaTeXStrings]]
-git-tree-sha1 = "f2355693d6778a178ade15952b7ac47a4ff97996"
+git-tree-sha1 = "50901ebc375ed41dbf8058da26f9de442febbbec"
uuid = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f"
-version = "1.3.0"
+version = "1.3.1"
[[Latexify]]
deps = ["Formatting", "InteractiveUtils", "LaTeXStrings", "MacroTools", "Markdown", "OrderedCollections", "Printf", "Requires"]
@@ -331,6 +337,11 @@ version = "0.16.1"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
SymEngine = "123dc426-2d89-5057-bbad-38513e3affd8"
+[[LazilyInitializedFields]]
+git-tree-sha1 = "410fe4739a4b092f2ffe36fcb0dcc3ab12648ce1"
+uuid = "0e77f7df-68c5-4e49-93ce-4cd80f5598bf"
+version = "1.2.1"
+
[[LibCURL]]
deps = ["LibCURL_jll", "MozillaCACerts_jll"]
uuid = "b27032c2-a3e7-50c8-80cd-2d36dbcbfd21"
@@ -378,10 +389,10 @@ uuid = "7add5ba3-2f88-524e-9cd5-f83b8a55f7b8"
version = "1.42.0+0"
[[Libiconv_jll]]
-deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
-git-tree-sha1 = "c7cb1f5d892775ba13767a87c7ada0b980ea0a71"
+deps = ["Artifacts", "JLLWrappers", "Libdl"]
+git-tree-sha1 = "f9557a255370125b405568f9767d6d195822a175"
uuid = "94ce4f54-9a6c-5748-9c1c-f9c7231a4531"
-version = "1.16.1+2"
+version = "1.17.0+0"
[[Libmount_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
@@ -409,13 +420,13 @@ uuid = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
deps = ["Base64", "IOCapture", "JSON", "REPL"]
path = ".."
uuid = "98b081ad-f1c9-55d3-8b20-4c87d4299306"
-version = "2.14.1"
+version = "2.16.0"
[[LogExpFunctions]]
deps = ["DocStringExtensions", "IrrationalConstants", "LinearAlgebra"]
-git-tree-sha1 = "c3ce8e7420b3a6e071e0fe4745f5d4300e37b13f"
+git-tree-sha1 = "7d6dd4e9212aebaeed356de34ccf262a3cd415aa"
uuid = "2ab3a3ac-af41-5b50-aa03-7779005ae688"
-version = "0.3.24"
+version = "0.3.26"
[LogExpFunctions.extensions]
LogExpFunctionsChainRulesCoreExt = "ChainRulesCore"
@@ -432,15 +443,15 @@ uuid = "56ddb016-857b-54e1-b83d-db4d58db5568"
[[LoggingExtras]]
deps = ["Dates", "Logging"]
-git-tree-sha1 = "cedb76b37bc5a6c702ade66be44f831fa23c681e"
+git-tree-sha1 = "c1dd6d7978c12545b4179fb6153b9250c96b0075"
uuid = "e6f89c97-d47a-5376-807f-9c37f3926c36"
-version = "1.0.0"
+version = "1.0.3"
[[MacroTools]]
deps = ["Markdown", "Random"]
-git-tree-sha1 = "42324d08725e200c23d4dfb549e0d5d89dede2d2"
+git-tree-sha1 = "9ee1618cbf5240e6d4e0371d6f24065083f60c48"
uuid = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09"
-version = "0.5.10"
+version = "0.5.11"
[[Markdown]]
deps = ["Base64"]
@@ -448,9 +459,9 @@ uuid = "d6f4376e-aef5-505a-96c1-9c027394607a"
[[MarkdownAST]]
deps = ["AbstractTrees", "Markdown"]
-git-tree-sha1 = "e8513266815200c0c8f522d6d44ffb5e9b366ae4"
+git-tree-sha1 = "465a70f0fc7d443a00dcdc3267a497397b8a3899"
uuid = "d0879d2d-cac2-40c8-9cee-1863dc0c7391"
-version = "0.1.1"
+version = "0.1.2"
[[MbedTLS]]
deps = ["Dates", "MbedTLS_jll", "MozillaCACerts_jll", "Random", "Sockets"]
@@ -515,9 +526,9 @@ version = "1.4.1"
[[OpenSSL_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl"]
-git-tree-sha1 = "bbb5c2115d63c2f1451cb70e5ef75e8fe4707019"
+git-tree-sha1 = "cc6e1927ac521b659af340e0ca45828a3ffc748f"
uuid = "458c3c95-2e84-50aa-8efc-19380b2a3a95"
-version = "1.1.22+0"
+version = "3.0.12+0"
[[Opus_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
@@ -571,9 +582,9 @@ version = "1.3.5"
[[Plots]]
deps = ["Base64", "Contour", "Dates", "Downloads", "FFMPEG", "FixedPointNumbers", "GR", "JLFzf", "JSON", "LaTeXStrings", "Latexify", "LinearAlgebra", "Measures", "NaNMath", "Pkg", "PlotThemes", "PlotUtils", "PrecompileTools", "Preferences", "Printf", "REPL", "Random", "RecipesBase", "RecipesPipeline", "Reexport", "RelocatableFolders", "Requires", "Scratch", "Showoff", "SparseArrays", "Statistics", "StatsBase", "UUIDs", "UnicodeFun", "UnitfulLatexify", "Unzip"]
-git-tree-sha1 = "9f8675a55b37a70aa23177ec110f6e3f4dd68466"
+git-tree-sha1 = "ccee59c6e48e6f2edf8a5b64dc817b6729f99eb5"
uuid = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
-version = "1.38.17"
+version = "1.39.0"
[Plots.extensions]
FileIOExt = "FileIO"
@@ -591,25 +602,25 @@ version = "1.38.17"
[[PrecompileTools]]
deps = ["Preferences"]
-git-tree-sha1 = "9673d39decc5feece56ef3940e5dafba15ba0f81"
+git-tree-sha1 = "03b4c25b43cb84cee5c90aa9b5ea0a78fd848d2f"
uuid = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
-version = "1.1.2"
+version = "1.2.0"
[[Preferences]]
deps = ["TOML"]
-git-tree-sha1 = "7eb1686b4f04b82f96ed7a4ea5890a4f0c7a09f1"
+git-tree-sha1 = "00805cd429dcb4870060ff49ef443486c262e38e"
uuid = "21216c6a-2e73-6563-6e65-726566657250"
-version = "1.4.0"
+version = "1.4.1"
[[Printf]]
deps = ["Unicode"]
uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7"
[[Qt6Base_jll]]
-deps = ["Artifacts", "CompilerSupportLibraries_jll", "Fontconfig_jll", "Glib_jll", "JLLWrappers", "Libdl", "Libglvnd_jll", "OpenSSL_jll", "Pkg", "Xorg_libXext_jll", "Xorg_libXrender_jll", "Xorg_libxcb_jll", "Xorg_xcb_util_image_jll", "Xorg_xcb_util_keysyms_jll", "Xorg_xcb_util_renderutil_jll", "Xorg_xcb_util_wm_jll", "Zlib_jll", "xkbcommon_jll"]
-git-tree-sha1 = "364898e8f13f7eaaceec55fd3d08680498c0aa6e"
+deps = ["Artifacts", "CompilerSupportLibraries_jll", "Fontconfig_jll", "Glib_jll", "JLLWrappers", "Libdl", "Libglvnd_jll", "OpenSSL_jll", "Vulkan_Loader_jll", "Xorg_libSM_jll", "Xorg_libXext_jll", "Xorg_libXrender_jll", "Xorg_libxcb_jll", "Xorg_xcb_util_cursor_jll", "Xorg_xcb_util_image_jll", "Xorg_xcb_util_keysyms_jll", "Xorg_xcb_util_renderutil_jll", "Xorg_xcb_util_wm_jll", "Zlib_jll", "libinput_jll", "xkbcommon_jll"]
+git-tree-sha1 = "37b7bb7aabf9a085e0044307e1717436117f2b3b"
uuid = "c0090381-4147-56d7-9ebc-da0b1113ec56"
-version = "6.4.2+3"
+version = "6.5.3+1"
[[REPL]]
deps = ["InteractiveUtils", "Markdown", "Sockets", "Unicode"]
@@ -636,11 +647,17 @@ git-tree-sha1 = "45e428421666073eab6f2da5c9d310d99bb12f9b"
uuid = "189a3867-3050-52da-a836-e630ba90ab69"
version = "1.2.2"
+[[RegistryInstances]]
+deps = ["LazilyInitializedFields", "Pkg", "TOML", "Tar"]
+git-tree-sha1 = "ffd19052caf598b8653b99404058fce14828be51"
+uuid = "2792f1a3-b283-48e8-9a74-f99dce5104f3"
+version = "0.1.0"
+
[[RelocatableFolders]]
deps = ["SHA", "Scratch"]
-git-tree-sha1 = "90bc7a7c96410424509e4263e277e43250c05691"
+git-tree-sha1 = "ffdaf70d81cf6ff22c2b6e733c900c3321cab864"
uuid = "05181044-ff0b-4ac5-8273-598c1e38db00"
-version = "1.0.0"
+version = "1.0.1"
[[Requires]]
deps = ["UUIDs"]
@@ -654,9 +671,9 @@ version = "0.7.0"
[[Scratch]]
deps = ["Dates"]
-git-tree-sha1 = "30449ee12237627992a99d5e30ae63e4d78cd24a"
+git-tree-sha1 = "3bac05bc7e74a75fd9cba4295cde4045d9fe2386"
uuid = "6c6a2e73-6563-6170-7368-637461726353"
-version = "1.2.0"
+version = "1.2.1"
[[Serialization]]
uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b"
@@ -677,9 +694,9 @@ uuid = "6462fe0b-24de-5631-8697-dd941f90decc"
[[SortingAlgorithms]]
deps = ["DataStructures"]
-git-tree-sha1 = "c60ec5c62180f27efea3ba2908480f8055e17cee"
+git-tree-sha1 = "5165dfb9fd131cf0c6957a3a7605dede376e7b63"
uuid = "a2af1166-a08f-5f64-846c-94a0d3cef48c"
-version = "1.1.1"
+version = "1.2.0"
[[SparseArrays]]
deps = ["Libdl", "LinearAlgebra", "Random", "Serialization", "SuiteSparse_jll"]
@@ -692,15 +709,15 @@ version = "1.9.0"
[[StatsAPI]]
deps = ["LinearAlgebra"]
-git-tree-sha1 = "45a7769a04a3cf80da1c1c7c60caf932e6f4c9f7"
+git-tree-sha1 = "1ff449ad350c9c4cbc756624d6f8a8c3ef56d3ed"
uuid = "82ae8749-77ed-4fe6-ae5f-f523153014b0"
-version = "1.6.0"
+version = "1.7.0"
[[StatsBase]]
deps = ["DataAPI", "DataStructures", "LinearAlgebra", "LogExpFunctions", "Missings", "Printf", "Random", "SortingAlgorithms", "SparseArrays", "Statistics", "StatsAPI"]
-git-tree-sha1 = "75ebe04c5bed70b91614d684259b661c9e6274a4"
+git-tree-sha1 = "1d77abd07f617c4868c33d4f5b9e1dbb2643c9cf"
uuid = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
-version = "0.34.0"
+version = "0.34.2"
[[SuiteSparse_jll]]
deps = ["Artifacts", "Libdl", "Pkg", "libblastrampoline_jll"]
@@ -728,15 +745,18 @@ deps = ["InteractiveUtils", "Logging", "Random", "Serialization"]
uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
[[TranscodingStreams]]
-deps = ["Random", "Test"]
-git-tree-sha1 = "9a6ae7ed916312b41236fcef7e0af564ef934769"
+git-tree-sha1 = "1fbeaaca45801b4ba17c251dd8603ef24801dd84"
uuid = "3bb67fe8-82b1-5028-8e26-92a6c54297fa"
-version = "0.9.13"
+version = "0.10.2"
+weakdeps = ["Random", "Test"]
+
+ [TranscodingStreams.extensions]
+ TestExt = ["Test", "Random"]
[[URIs]]
-git-tree-sha1 = "074f993b0ca030848b897beff716d93aca60f06a"
+git-tree-sha1 = "67db6cc7b3821e19ebe75791a9dd19c9b1188f2b"
uuid = "5c2747f8-b7ea-4ff2-ba2e-563bfd36b1d4"
-version = "1.4.2"
+version = "1.5.1"
[[UUIDs]]
deps = ["Random", "SHA"]
@@ -753,9 +773,9 @@ version = "0.4.1"
[[Unitful]]
deps = ["Dates", "LinearAlgebra", "Random"]
-git-tree-sha1 = "1cd9b6d3f637988ca788007b7466c132feebe263"
+git-tree-sha1 = "a72d22c7e13fe2de562feda8645aa134712a87ee"
uuid = "1986cc42-f94f-5a68-af5c-568840ba703d"
-version = "1.16.1"
+version = "1.17.0"
[Unitful.extensions]
ConstructionBaseUnitfulExt = "ConstructionBase"
@@ -776,11 +796,17 @@ git-tree-sha1 = "ca0969166a028236229f63514992fc073799bb78"
uuid = "41fe7b60-77ed-43a1-b4f0-825fd5a5650d"
version = "0.2.0"
+[[Vulkan_Loader_jll]]
+deps = ["Artifacts", "JLLWrappers", "Libdl", "Wayland_jll", "Xorg_libX11_jll", "Xorg_libXrandr_jll", "xkbcommon_jll"]
+git-tree-sha1 = "2f0486047a07670caad3a81a075d2e518acc5c59"
+uuid = "a44049a8-05dd-5a78-86c9-5fde0876e88c"
+version = "1.3.243+0"
+
[[Wayland_jll]]
-deps = ["Artifacts", "Expat_jll", "JLLWrappers", "Libdl", "Libffi_jll", "Pkg", "XML2_jll"]
-git-tree-sha1 = "ed8d92d9774b077c53e1da50fd81a36af3744c1c"
+deps = ["Artifacts", "EpollShim_jll", "Expat_jll", "JLLWrappers", "Libdl", "Libffi_jll", "Pkg", "XML2_jll"]
+git-tree-sha1 = "7558e29847e99bc3f04d6569e82d0f5c54460703"
uuid = "a2964d1f-97da-50d4-b82a-358c7fce9d89"
-version = "1.21.0+0"
+version = "1.21.0+1"
[[Wayland_protocols_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
@@ -789,10 +815,10 @@ uuid = "2381bf8a-dfd0-557d-9999-79630e7b1b91"
version = "1.25.0+0"
[[XML2_jll]]
-deps = ["Artifacts", "JLLWrappers", "Libdl", "Libiconv_jll", "Pkg", "Zlib_jll"]
-git-tree-sha1 = "93c41695bc1c08c46c5899f4fe06d6ead504bb73"
+deps = ["Artifacts", "JLLWrappers", "Libdl", "Libiconv_jll", "Zlib_jll"]
+git-tree-sha1 = "24b81b59bd35b3c42ab84fa589086e19be919916"
uuid = "02c8fc9c-b97f-50b9-bbe4-9be30ff0a78a"
-version = "2.10.3+0"
+version = "2.11.5+0"
[[XSLT_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Libgcrypt_jll", "Libgpg_error_jll", "Libiconv_jll", "Pkg", "XML2_jll", "Zlib_jll"]
@@ -802,9 +828,21 @@ version = "1.1.34+0"
[[XZ_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl"]
-git-tree-sha1 = "2222b751598bd9f4885c9ce9cd23e83404baa8ce"
+git-tree-sha1 = "cf2c7de82431ca6f39250d2fc4aacd0daa1675c0"
uuid = "ffd25f8a-64ca-5728-b0f7-c24cf3aae800"
-version = "5.4.3+1"
+version = "5.4.4+0"
+
+[[Xorg_libICE_jll]]
+deps = ["Libdl", "Pkg"]
+git-tree-sha1 = "e5becd4411063bdcac16be8b66fc2f9f6f1e8fe5"
+uuid = "f67eecfb-183a-506d-b269-f58e52b52d7c"
+version = "1.0.10+1"
+
+[[Xorg_libSM_jll]]
+deps = ["Libdl", "Pkg", "Xorg_libICE_jll"]
+git-tree-sha1 = "4a9d9e4c180e1e8119b5ffc224a7b59d3a7f7e18"
+uuid = "c834827a-8449-5923-a945-d239c165b7dd"
+version = "1.2.3+0"
[[Xorg_libX11_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Xorg_libxcb_jll", "Xorg_xtrans_jll"]
@@ -884,6 +922,12 @@ git-tree-sha1 = "730eeca102434283c50ccf7d1ecdadf521a765a4"
uuid = "cc61e674-0454-545c-8b26-ed2c68acab7a"
version = "1.1.2+0"
+[[Xorg_xcb_util_cursor_jll]]
+deps = ["Artifacts", "JLLWrappers", "Libdl", "Xorg_xcb_util_image_jll", "Xorg_xcb_util_jll", "Xorg_xcb_util_renderutil_jll"]
+git-tree-sha1 = "04341cb870f29dcd5e39055f895c39d016e18ccd"
+uuid = "e920d4aa-a673-5f3a-b3d7-f755a4d47c43"
+version = "0.1.4+0"
+
[[Xorg_xcb_util_image_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg", "Xorg_xcb_util_jll"]
git-tree-sha1 = "0fab0a40349ba1cba2c1da699243396ff8e94b97"
@@ -943,11 +987,23 @@ git-tree-sha1 = "49ce682769cd5de6c72dcf1b94ed7790cd08974c"
uuid = "3161d3a3-bdf6-5164-811a-617609db77b4"
version = "1.5.5+0"
+[[eudev_jll]]
+deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg", "gperf_jll"]
+git-tree-sha1 = "431b678a28ebb559d224c0b6b6d01afce87c51ba"
+uuid = "35ca27e7-8b34-5b7f-bca9-bdc33f59eb06"
+version = "3.2.9+0"
+
[[fzf_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
-git-tree-sha1 = "868e669ccb12ba16eaf50cb2957ee2ff61261c56"
+git-tree-sha1 = "47cf33e62e138b920039e8ff9f9841aafe1b733e"
uuid = "214eeab7-80f7-51ab-84ad-2988db7cef09"
-version = "0.29.0+0"
+version = "0.35.1+0"
+
+[[gperf_jll]]
+deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
+git-tree-sha1 = "3516a5630f741c9eecb3720b1ec9d8edc3ecc033"
+uuid = "1a1c6b14-54f6-533d-8383-74cd7377aa70"
+version = "3.1.1+0"
[[libaom_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
@@ -966,12 +1022,24 @@ deps = ["Artifacts", "Libdl"]
uuid = "8e850b90-86db-534c-a0d3-1478176c7d93"
version = "5.8.0+0"
+[[libevdev_jll]]
+deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
+git-tree-sha1 = "141fe65dc3efabb0b1d5ba74e91f6ad26f84cc22"
+uuid = "2db6ffa8-e38f-5e21-84af-90c45d0032cc"
+version = "1.11.0+0"
+
[[libfdk_aac_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "daacc84a041563f965be61859a36e17c4e4fcd55"
uuid = "f638f0a6-7fb0-5443-88ba-1cc74229b280"
version = "2.0.2+0"
+[[libinput_jll]]
+deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg", "eudev_jll", "libevdev_jll", "mtdev_jll"]
+git-tree-sha1 = "ad50e5b90f222cfe78aa3d5183a20a12de1322ce"
+uuid = "36db933b-70db-51c0-b978-0f229ee0e533"
+version = "1.18.0+0"
+
[[libpng_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg", "Zlib_jll"]
git-tree-sha1 = "94d180a6d2b5e55e447e2d27a29ed04fe79eb30c"
@@ -984,6 +1052,12 @@ git-tree-sha1 = "b910cb81ef3fe6e78bf6acee440bda86fd6ae00c"
uuid = "f27f6e37-5d2b-51aa-960f-b287f2bc3b7a"
version = "1.3.7+1"
+[[mtdev_jll]]
+deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
+git-tree-sha1 = "814e154bdb7be91d78b6802843f76b6ece642f11"
+uuid = "009596ad-96f7-51b1-9f1b-5ce2d5e8a71e"
+version = "1.1.6+0"
+
[[nghttp2_jll]]
deps = ["Artifacts", "Libdl"]
uuid = "8e850ede-7688-5339-a07c-302acd2aaf8d"
@@ -1008,6 +1082,6 @@ version = "3.5.0+0"
[[xkbcommon_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg", "Wayland_jll", "Wayland_protocols_jll", "Xorg_libxcb_jll", "Xorg_xkeyboard_config_jll"]
-git-tree-sha1 = "9ebfc140cc56e8c2156a15ceac2f0302e327ac0a"
+git-tree-sha1 = "9c304562909ab2bab0262639bd4f444d7bc2be37"
uuid = "d8fb68d0-12a3-5cfd-a85a-d49703b185fd"
-version = "1.4.1+0"
+version = "1.4.1+1"
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/docs/src/reference.md b/docs/src/reference.md
new file mode 100644
index 0000000..a485102
--- /dev/null
+++ b/docs/src/reference.md
@@ -0,0 +1,5 @@
+# Reference
+
+```@docs
+Literate
+```
diff --git a/src/Literate.jl b/src/Literate.jl
index 37a5c70..2727cab 100644
--- a/src/Literate.jl
+++ b/src/Literate.jl
@@ -186,6 +186,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
@@ -322,6 +324,7 @@ function create_configuration(inputfile; user_config, user_kwargs, type=nothing)
cfg["flavor"] = type === (:md) ? DocumenterFlavor() : DefaultFlavor()
cfg["credit"] = true
cfg["mdstrings"] = false
+ cfg["softscope"] = type === (:nb) ? true : false # on for Jupyter notebooks
cfg["keep_comments"] = false
cfg["execute"] = type === :md ? false : true
cfg["codefence"] = pick_codefence(
@@ -419,6 +422,8 @@ Available options:
- `devurl` (default: `"dev"`): URL for "in-development" docs, see [Documenter docs]
(https://juliadocs.github.io/Documenter.jl/). Unused if `repo_root_url`/
`nbviewer_root_url`/`binder_root_url` are set.
+- `softscope` (default: `true` for Jupyter notebooks, `false` otherwise): enable/disable
+ "soft" scoping rules when executing, see e.g. https://github.com/JuliaLang/SoftGlobalScope.jl.
- `repo_root_url`: URL to the root of the repository. Determined automatically on Travis CI,
GitHub Actions and GitLab CI. Used for `@__REPO_ROOT_URL__`.
- `nbviewer_root_url`: URL to the root of the repository as seen on nbviewer. Determined
@@ -514,17 +519,18 @@ function script(inputfile, outputdir=pwd(); config::AbstractDict=Dict(), kwargs.
# create the script file
ioscript = IOBuffer()
+ isfirst = true
for chunk in chunks
if isa(chunk, CodeChunk)
+ isfirst ? (isfirst = false) : write(ioscript, '\n') # add a newline between each chunk
for line in chunk.lines
write(ioscript, line, '\n')
end
- write(ioscript, '\n') # add a newline between each chunk
elseif isa(chunk, MDChunk) && config["keep_comments"]::Bool
+ isfirst ? (isfirst = false) : write(ioscript, '\n') # add a newline between each chunk
for line in chunk.lines
write(ioscript, rstrip(line.first * "# " * line.second) * '\n')
end
- write(ioscript, '\n') # add a newline between each chunk
end
end
@@ -583,12 +589,14 @@ function markdown(inputfile, outputdir=pwd(); config::AbstractDict=Dict(), kwarg
any(write_line, chunk.lines) && write(iomd, seekstart(iocode))
if execute
cd(config["literate_outputdir"]) do
- execute_markdown!(iomd, sb, join(chunk.lines, '\n'), outputdir;
+ execute_markdown!(iomd, sb, join(chunk.lines, '\n'),
+ config["literate_outputdir"];
inputfile=config["literate_inputfile"],
fake_source=config["literate_outputfile"],
flavor=config["flavor"],
image_formats=config["image_formats"],
file_prefix="$(config["name"])-$(chunknum)",
+ softscope=config["softscope"],
)
end
end
@@ -606,9 +614,10 @@ end
function execute_markdown!(io::IO, sb::Module, block::String, outputdir;
inputfile::String, fake_source::String,
- flavor::AbstractFlavor, image_formats::Vector, file_prefix::String)
+ flavor::AbstractFlavor, image_formats::Vector, file_prefix::String,
+ softscope::Bool)
# TODO: Deal with explicit display(...) calls
- r, str, _ = execute_block(sb, block; inputfile=inputfile, fake_source=fake_source)
+ r, str, _ = execute_block(sb, block; inputfile=inputfile, fake_source=fake_source, softscope=softscope)
# issue #101: consecutive codefenced blocks need newline
# issue #144: quadruple backticks allow for triple backticks in the output
plain_fence = "\n````\n" => "\n````"
@@ -743,7 +752,8 @@ function jupyter_notebook(chunks, config)
try
cd(config["literate_outputdir"]) do
nb = execute_notebook(nb; inputfile=config["literate_inputfile"],
- fake_source=config["literate_outputfile"])
+ fake_source=config["literate_outputfile"],
+ softscope=config["softscope"])
end
catch err
@error "error when executing notebook based on input file: " *
@@ -754,7 +764,7 @@ function jupyter_notebook(chunks, config)
return nb
end
-function execute_notebook(nb; inputfile::String, fake_source::String)
+function execute_notebook(nb; inputfile::String, fake_source::String, softscope::Bool)
sb = sandbox()
execution_count = 0
for cell in nb["cells"]
@@ -762,7 +772,7 @@ function execute_notebook(nb; inputfile::String, fake_source::String)
execution_count += 1
cell["execution_count"] = execution_count
block = join(cell["source"])
- r, str, display_dicts = execute_block(sb, block; inputfile=inputfile, fake_source=fake_source)
+ r, str, display_dicts = execute_block(sb, block; inputfile=inputfile, fake_source=fake_source, softscope=softscope)
# str should go into stream
if !isempty(str)
@@ -844,7 +854,7 @@ function Base.display(ld::LiterateDisplay, mime::MIME, x)
end
# Execute a code-block in a module and capture stdout/stderr and the result
-function execute_block(sb::Module, block::String; inputfile::String, fake_source::String)
+function execute_block(sb::Module, block::String; inputfile::String, fake_source::String, softscope::Bool)
@debug """execute_block($sb, block)
```
$(block)
@@ -860,7 +870,11 @@ function execute_block(sb::Module, block::String; inputfile::String, fake_source
# `rethrow = Union{}` means that we try-catch all the exceptions thrown in the do-block
# and return them via the return value (they get handled below).
c = IOCapture.capture(rethrow = Union{}) do
- include_string(sb, block, fake_source)
+ if softscope
+ include_string(REPL.softscope, sb, block, fake_source)
+ else
+ include_string(sb, block, fake_source)
+ end
end
popdisplay(disp) # IOCapture.capture has a try-catch so should always end up here
if c.error
diff --git a/test/runtests.jl b/test/runtests.jl
index 16c40cd..17af53f 100644
--- a/test/runtests.jl
+++ b/test/runtests.jl
@@ -236,6 +236,11 @@ content = """
## Indented comment
end
+ # Some inline html
+ # ```@raw html
+ # Literate.jl
+ # ```
+
# Semicolon output supression
1 + 1;
@@ -348,7 +353,6 @@ const GITLAB_ENV = Dict(
hidden2 * hidden2
# This file was generated using Literate.jl, https://github.com/fredrikekre/Literate.jl
-
"""
script = read(joinpath(outdir, "inputfile.jl"), String)
@test script == expected_script
@@ -605,6 +609,11 @@ end end
end
````
+ Some inline html
+ ```@raw html
+ Literate.jl
+ ```
+
Semicolon output supression
````@example inputfile
@@ -904,8 +913,43 @@ end end
write(f, "1 + 1")
Literate.markdown(f, outdir)
@test occursin("file_with_space", read(joinpath(outdir, "file with space.md"), String))
- end
- end
+
+ # Relative output directory + image output
+ # https://github.com/fredrikekre/Literate.jl/issues/228
+ write(
+ inputfile,
+ """
+ struct SVG end
+ Base.show(io::IO, mime::MIME"image/svg+xml", ::SVG) = print(io, "issue228")
+ SVG()
+ """,
+ )
+ Literate.markdown(inputfile, relpath(outdir); execute=true,
+ flavor=Literate.CommonMarkFlavor())
+ @test read(joinpath(outdir, "inputfile-1.svg"), String) == "issue228"
+
+ # Softscope
+ write(
+ inputfile,
+ """
+ ret = 0
+ for k = 1:10
+ ret += k
+ end
+ println("ret = ", ret)
+ """
+ )
+ Literate.markdown(inputfile, outdir; execute=true, softscope=true)
+ @test occursin("ret = 55", read(joinpath(outdir, "inputfile.md"), String))
+ ## Disabled softscope
+ try
+ Literate.markdown(inputfile, outdir; execute=true, softscope=false)
+ error("unreachable")
+ catch err
+ @test occursin(r"`?ret`? not defined", sprint(Base.showerror, err))
+ end
+ end # cd(sandbox)
+ end # mktemp
end end
@testset "Literate.notebook" begin; Base.CoreLogging.with_logger(Base.CoreLogging.NullLogger()) do
@@ -1049,6 +1093,14 @@ end end
]
""",
+ """
+ "source": [
+ "Some inline html\\n",
+ "\\n",
+ " Literate.jl"
+ ]
+ """,
+
"""
"metadata": {
"meta": "data"
@@ -1311,8 +1363,33 @@ end end
@test keys(cellout[1]["data"]) == Set(("text/latex",))
@test cellout[1]["data"]["text/latex"] == "DF(4) as text/latex"
@test !haskey(cellout[1], "execution_count")
- end
- end
+
+ # Softscope
+ # TODO: Windows CI says here, but no longer: The input file that have been used
+ # above multiple times without problem now gives
+ # "SystemError: opening file: Invalid argument" for some reason...
+ new_inputfile = "inputfile2.jl"
+ write(
+ new_inputfile,
+ """
+ ret = 0
+ for k = 1:10
+ ret += k
+ end
+ println("ret = ", ret)
+ """
+ )
+ Literate.notebook(new_inputfile, outdir)
+ @test occursin("ret = 55", read(joinpath(outdir, "inputfile2.ipynb"), String))
+ ## Disabled softscope
+ try
+ Literate.notebook(new_inputfile, outdir; softscope=false)
+ error("unreachable")
+ catch err
+ @test occursin(r"`?ret`? not defined", sprint(Base.showerror, err))
+ end
+ end # cd(sandbox)
+ end # mktempdir
end end
@testset "Configuration" begin; Base.CoreLogging.with_logger(Base.CoreLogging.NullLogger()) do