Skip to content

Commit

Permalink
Update doc for mdstring support in Literate (#882)
Browse files Browse the repository at this point in the history
* Update doc for mdstring support in Literate.

* Fix Literate compat for mdstring support
  • Loading branch information
luraess authored Sep 13, 2021
1 parent 12946c3 commit aa2dbe2
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 deletions.
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

0 comments on commit aa2dbe2

Please sign in to comment.