diff --git a/NEWS.md b/NEWS.md
index 1bf91e92c..2ef99fd7c 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,5 +1,36 @@
# NEWS
+## v0.3
+
+Thanks a lot to [@cserteGT3](https://github.com/cserteGT3) for his input and [@cormullion](https://github.com/cormullion) for great feedback on the markdown parser through extensive testing.
+
+**Features**
+
+* indented code blocks are now supported (issue #207, PR #217)
+* reference links and images like `[link][id]` with later `[id]: url` are now supported (issue #201, PR #214)
+* headers are now links which facilitates internal hyper-references
+* automatic table of contents via `\toc` or `\tableofcontents` (PR #188)
+* added `\\` as a way to force the introduction of a line break, this can be useful in the context of inclusions etc (see https://github.com/cserteGT3/JuDocPlottest/issues/1 for context)
+* html entities are now supported (issue #206, PR #209)
+* double backticks are now supported for inline code (see issue #204 and PR #210)
+* added `\textinput` command to display code output as formatted text (PR #194)
+* added `\tableinput` command to insert and format a table corresponding to a csv file (PR #197, creds to @cserteGT3)
+
+**Bug fixes & improvements**
+
+* showing error message when an eval'd block fails (PR #187)
+* issues with backslashes in code environment etc (issue #205, PR #209)
+* improved status messages for `cleanpull` (PR #190) and adding the possibility to specify a commit message for `publish` (PR #191, creds to @cserteGT3)
+
+**Templates** (JuDocTemplates is now `0.2.5`)
+
+* update of KaTeX and Highlight.js respectively to `0.11` and `9.15.10`
+* fixing the default rights of files to `644`
+
+**Other**
+
+* general cleanup of the code (trying to make naming more consistent and less clunky, general cleaning up etc)
+
## v0.2
Thanks a lot to [@Invarianz](https://github.com/Invarianz), [@cserteGT3](https://github.com/cserteGT3) and [@mbaz](https://github.com/mbaz) for help and feedback leading to this version.
diff --git a/Project.toml b/Project.toml
index 99881ab09..f120002de 100644
--- a/Project.toml
+++ b/Project.toml
@@ -1,7 +1,7 @@
name = "JuDoc"
uuid = "4ca9428c-4c75-11e9-2efb-bf5cb6c1e8f8"
authors = ["Thibaut Lienart
+dot(a, a) = 14
```
and will look like
@@ -776,14 +839,16 @@ See also [Templating](@ref) for how page variables can be used in the HTML.
A few variables are already present and used in the basic templates (you can still modify their value though it has to match the type):
-| Name | Accepted types | Default value | Function |
-| :--- | :------------- | :------------ | :------- |
-| `title` | `Nothing`, `String` | `nothing` | title of the page (tab name)
+| Name | Accepted types | Default value | Function |
+| :-------- | :------------- | :------------ | :------- |
+| `title` | `Nothing`, `String` | `nothing` | title of the page (tab name)
| `hasmath` | `Bool` | `true` | if `true` the KaTeX stylesheet and script will be added to the page
| `hascode` | `Bool` | `false` | if `false` the highlight stylesheet and script will be added to the page
| `date` | `String`, `Date`, `Nothing` | `Date(1)` | a date variable
+| `lang` | `String` | `"julia"` | the default language to use for code blocks
+| `reflinks`| `Bool` | `true` | whether there may be referred links like like `[link][id]` and `[id]: some/url`, turn this to false if your code has patterns like `[...]: ...` which are **not** link definitions (see also [quirks](#Quirks-1))
-Then there are some variables that are automatically assigned and that you should therefore not assign yourself (but you can use them):
+Then there are some variables that are automatically assigned and that you should therefore **not** assign yourself (but you can use them):
| Name | Type | Value | Function |
| :--- | :------------- | :------------ | :------- |
@@ -807,7 +872,8 @@ For instance you could set `hasmath` globally to `false` and `hascode` globally
There are also a few pre-defined global variables:
-| Name | Accepted types | Default value | Function |
-| :--- | :------------- | :------------ | :------- |
-| `author` | `String`, `Nothing` | `THE AUTHOR` | author (e.g. may appear in footer)
+| Name | Accepted types | Default value | Function |
+| :------------ | :------------- | :------------ | :------- |
+| `author` | `String`, `Nothing` | `THE AUTHOR` | author (e.g. may appear in footer)
| `date_format` | `String` | `U dd, yyyy` | a valid date format specifier
+| `prepath` | `String` | "" | if the website is meant to be a _project_ website on GitHub for instance corresponding to a repo `github.com/username/repo` as opposed to `github.com/username.github.io`, then all url paths should be prepended with `repo/` which you can do by specifying `@def prepath = "repo"` (see also [hosting the website as a project website](/man/workflow/#Hosting-the-website-as-a-project-website-1))|
diff --git a/src/converter/html.jl b/src/converter/html.jl
index ff56330e5..d4afd6241 100644
--- a/src/converter/html.jl
+++ b/src/converter/html.jl
@@ -40,7 +40,9 @@ function convert_html(hs::AbstractString, allvars::PageVars; isoptim::Bool=false
# See issue #204, basically not all markdown links are processed as
# per common mark with the JuliaMarkdown, so this is a patch that kind
# of does
- fhs = find_and_fix_md_links(fhs)
+ if haskey(allvars, "reflinks") && allvars["reflinks"].first
+ fhs = find_and_fix_md_links(fhs)
+ end
# if it ends with dot(a, a) = 14
, chop it off # this may happen if the first element parsed is an ocblock (not text) diff --git a/src/converter/md_blocks.jl b/src/converter/md_blocks.jl index 2e8aeeb9d..6f671c44d 100644 --- a/src/converter/md_blocks.jl +++ b/src/converter/md_blocks.jl @@ -14,7 +14,7 @@ function convert_block(β::AbstractBlock, lxcontext::LxContext)::AbstractString βn == :CODE_INLINE && return html_code_inline(content(β) |> Markdown.htmlesc) βn == :CODE_BLOCK_LANG && return convert_code_block(β.ss) βn == :CODE_BLOCK_IND && return convert_indented_code_block(β.ss) - βn == :CODE_BLOCK && return md2html(β.ss) + βn == :CODE_BLOCK && return html_code(content(β) |> Markdown.htmlesc, "{{fill lang}}") βn == :ESCAPE && return chop(β.ss, head=3, tail=3) # Math block --> needs to call further processing to resolve possible latex @@ -185,5 +185,5 @@ function convert_indented_code_block(ss::SubString)::String # 1. decrease indentation of all lines (either frontal \n\t or \n⎵⎵⎵⎵) code = replace(ss, r"\n(?:\t| {4})" => "\n") # 2. return; lang is a LOCAL_PAGE_VARS that is julia by default and can be set - return html_code(strip(code), "{{fill lang}}") + return html_code(strip(code) |> Markdown.htmlesc, "{{fill lang}}") end diff --git a/src/jd_vars.jl b/src/jd_vars.jl index 16fd1bb94..16a9070bf 100644 --- a/src/jd_vars.jl +++ b/src/jd_vars.jl @@ -53,6 +53,7 @@ is processed. LOCAL_PAGE_VARS["jd_mtime"] = Pair(Date(1), (Date,)) # time of last modification LOCAL_PAGE_VARS["jd_rpath"] = Pair("", (String,)) # local path to file src/[...]/blah.md LOCAL_PAGE_VARS["lang"] = Pair("julia", (String,)) # default lang for indented code + LOCAL_PAGE_VARS["reflinks"] = Pair(true, (Bool,)) # whether there are reflinks or not return nothing end diff --git a/src/manager/post_processing.jl b/src/manager/post_processing.jl index 14b120a9e..bbe5ca6ee 100644 --- a/src/manager/post_processing.jl +++ b/src/manager/post_processing.jl @@ -8,7 +8,7 @@ Does a full pass followed by a pre-rendering and minification step. * `prerender=true`: whether to pre-render katex and highlight.js (requires `node.js`) * `minify=true`: whether to minify output (requires `python3` and `css_html_js_minify`) * `sig=false`: whether to return an integer indicating success (see [`publish`](@ref)) -* `prepath=` +* `prepath=""`: set this to something like "project-name" if it's a project page Note: if the prerendering is set to `true`, the minification will take longer as the HTML files will be larger (especially if you have lots of maths on pages). @@ -75,6 +75,7 @@ In other scenarios you should probably do this manually. * `prerender=true`: prerender javascript before pushing see [`optimize`](@ref) * `minify=true`: minify output before pushing see [`optimize`](@ref) * `nopass=false`: set this to true if you have already run `optimize` manually. +* `prepath=""`: set this to something like "project-name" if it's a project page * `message="jd-update"`: add commit message. """ function publish(; prerender::Bool=true, minify::Bool=true, nopass::Bool=false, diff --git a/test/converter/markdown3.jl b/test/converter/markdown3.jl index a4d119489..b69d683d3 100644 --- a/test/converter/markdown3.jl +++ b/test/converter/markdown3.jl @@ -37,7 +37,7 @@ @test isapproxstr(st |> seval, raw"""
Hello \ blah \ end
and B \ c
end and
-
A \ b
+ A \ b
done
""")
end
@@ -58,7 +58,7 @@ end
@test isapproxstr(st |> seval, raw"""
Hello \ blah \ end
and B \ c
end
and
-
A \ b
+ A \ b
done
""")
end
@@ -244,12 +244,12 @@ end
A
- a = 1+1
- if a > 1
+ a = 1+1
+ if a > 1
@show a
end
- b = 2
- @show a+b
+ b = 2
+ @show a+b
end
@@ -272,7 +272,7 @@ end
and
- a = 1+1
+ a = 1+1
then