Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update doc for mdstring support in Literate #882

Merged
merged 3 commits into from
Sep 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ DocStringExtensions = "0.8"
ExprTools = "0.1"
FranklinTemplates = "0.8.16"
HTTP = "0.8, 0.9"
Literate = "2"
Literate = "2.9"
LiveServer = "0.4, 0.5, 0.6, 0.7"
NodeJS = "0.6, 1"
OrderedCollections = "1"
Expand Down
27 changes: 23 additions & 4 deletions docs/code/literate.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
@def hascode = true
@def showall = true
@def hasmath = true
@def literate_mds = true

# Work with Literate.jl

Expand Down Expand Up @@ -38,7 +39,7 @@ We recommend you have a folder `/_literate/` in your root folder, place your lit
### Tricks

In the `showall = true` mode, the last line of each code block is displayed in full.
In some cases you will have to think about this a bit more than you would in your REPL and might for instance:
In some cases you will have to think about this a bit more than you would in your REPL and might for instance:

@@tlist
* _suppress the output_, in which case you should add a `;` at the end of the line
Expand Down Expand Up @@ -73,6 +74,22 @@ x = randn(10)
@show x[1]
```

The `literate_mds = true` mode adds support for using literal markdown strings, `md""" ... """`, for the markdown sections, a feature introduced in [Literate v2.9](https://fredrikekre.github.io/Literate.jl/v2/fileformat/#Multiline-comments-and-markdown-strings). For example

```md
md"""
# Title
something cool
"""
```

is rewritten to

```
# # Title
# something cool
```

## Example

### Script
Expand All @@ -94,9 +111,11 @@ x ≈ 0

abs(x) < eps()

# #### Conclusion
#
# The equation is proven thanks to our very rigorous proof.
md"""
#### Conclusion
The equation $ \exp(i\pi) + 1 \quad = \quad 0 $ is proven thanks to our very rigorous proof.
"""
`````

### Result
Expand Down