Skip to content

Commit

Permalink
adding support for mdstring in Literate (#881)
Browse files Browse the repository at this point in the history
  • Loading branch information
tlienart authored Sep 10, 2021
1 parent 9cd419e commit 12946c3
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Franklin"
uuid = "713c75ef-9fc9-4b05-94a9-213340da978e"
authors = ["Thibaut Lienart <[email protected]>"]
version = "0.10.51"
version = "0.10.52"

[deps]
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
Expand Down
22 changes: 16 additions & 6 deletions src/eval/literate.jl
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,23 @@ function literate_to_franklin(rpath::AS)::Tuple{String,Bool}
# don't show Literate's infos
Logging.disable_logging(Logging.LogLevel(Logging.Info))
# >> output the markdown
Literate.markdown(fpath, outpath;
config=Dict("codefence" => (LITERATE_JULIA_FENCE => "```")),
documenter=false, postprocess=literate_post_process, credit=false)
Literate.markdown(
fpath, outpath;
flavor=Literate.CommonMarkFlavor(),
mdstrings=locvar(:literate_mds)::Bool,
config=Dict("codefence" => (LITERATE_JULIA_FENCE => "```")),
postprocess=literate_post_process,
credit=false
)
# >> output the script
Literate.script(fpath, outpath; documenter=false,
postprocess=s->(MESSAGE_FILE_GEN_LIT * s),
name=fname * "_script", credit=false)
Literate.script(
fpath, outpath;
flavor=Literate.CommonMarkFlavor(),
mdstrings=locvar(:literate_mds)::Bool,
postprocess=s->(MESSAGE_FILE_GEN_LIT * s),
name=fname * "_script",
credit=false
)
# bring back logging
Logging.disable_logging(Logging.LogLevel(Logging.Debug))
# see if things have changed
Expand Down
2 changes: 2 additions & 0 deletions src/utils/vars.jl
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ const GLOBAL_VARS_DEFAULT = [
"fd_rss_feed_url" => dpair(""),
# keep track of all anchors {label => page} in case of clash, there's no guarantee
"anchors" => dpair(LittleDict{String,String}()),
# allow md strings in Literate
"literate_mds" => dpair(false),
# -----------------------------------------------------
# LEGACY
"div_content" => dpair(""), # see build_page
Expand Down

2 comments on commit 12946c3

@tlienart
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/44670

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.10.52 -m "<description of version>" 12946c30b47b076c52925140bc34631f21f86bdc
git push origin v0.10.52

Please sign in to comment.