Browse Source

move documenter math inside documenter kwarg

pull/5/head
Fredrik Ekre 8 years ago
parent
commit
60401022ad
  1. 13
      docs/src/documenter.md
  2. 5
      src/Examples.jl

13
docs/src/documenter.md

@ -33,4 +33,15 @@ if we set `documenter = true`: @@ -33,4 +33,15 @@ if we set `documenter = true`:
[`Examples.notebook`](@ref):
- Documenter style `@ref`s and `@id` will be removed. This means that you can use
`@ref` and `@id` in the source file without them leaking to the notebook.
- Documenter style markdown math
````
```math
\int f dx
```
````
is replaced with notebook compatible
```
\begin{equation}
\int f dx
\end{equation}
```

5
src/Examples.jl

@ -314,7 +314,6 @@ function notebook(inputfile, outputdir; preprocess = identity, postprocess = ide @@ -314,7 +314,6 @@ function notebook(inputfile, outputdir; preprocess = identity, postprocess = ide
r".*#jl$\n?"m => "",
r"^#nb "m => "",
"@__NAME__" => name,
r"```math(.*?)```"s => s"\\begin{equation}\1\\end{equation}",
]
content = replace(content, repl)
end
@ -324,10 +323,12 @@ function notebook(inputfile, outputdir; preprocess = identity, postprocess = ide @@ -324,10 +323,12 @@ function notebook(inputfile, outputdir; preprocess = identity, postprocess = ide
# run some Documenter specific things
if documenter # TODO: safe to do this always?
# remove documenter style `@ref`s and `@id`s
## - replace ```math ... ``` with \begin{equation} ... \end{equation}
## - remove documenter style `@ref`s and `@id`s
# TODO: remove @docs, @setup etc? Probably not, since these are complete blocks
# and the user can just mark those lines with #md
for repl in Pair{Any,Any}[
r"```math(.*?)```"s => s"\\begin{equation}\1\\end{equation}",
r"\[(.*?)\]\(@ref\)" => s"\1",
r"\[(.*?)\]\(@ref .*?\)" => s"\1",
r"\[(.*?)\]\(@id .*?\)" => s"\1",

Loading…
Cancel
Save