Major restructuring of extension processors, not yet complete

This commit is contained in:
Simon Brooke 2020-02-09 01:42:31 +00:00
parent e00beaf790
commit 54b82931b2
8 changed files with 185 additions and 11 deletions

View file

@ -33,7 +33,7 @@
:default-locale "en-GB" ;; default language used for messages
:formatters {"vega" smeagol.formatting/process-vega
"vis" smeagol.formatting/process-vega
"mermaid" smeagol.formatting/process-mermaid
"mermaid" smeagol.extensions.mermaid/process-mermaid
"backticks" smeagol.formatting/process-backticks}
:log-level :info ;; the minimum logging level; one of
;; :trace :debug :info :warn :error :fatal

View file

@ -36,7 +36,7 @@ Data files can be uploaded in the same way as images, by using the **upload a fi
Graphs can now be embedded in a page using the [Mermaid](https://mermaid-js.github.io/mermaid/#/) graph description language. The graph description should start with a line comprising three back-ticks and then the word `mermaid`, and end with a line comprising just three backticks.
Here's an example culled from the Mermaid documentation.
Here's an example culled from the Mermaid documentation. Edit this page to see the specification.
### GANTT Chart
@ -58,6 +58,14 @@ gantt
Add to mermaid :1d
```
Mermaid graph specifications can also be loaded from URLs. Here's another example; again, edit this page to see how the trick is done.
### Class Diagram
```mermaid
data/classes.mermaid
```
## Writing your own custom formatters
A custom formatter is simply a Clojure function which takes a string and an integer as arguments and produces a string as output. The string is the text the user has typed into their markdown; the integer is simply a number you can use to keep track of which addition to the page this is, in order, for example, to fix up some JavaScript to render it.

View file

@ -0,0 +1,14 @@
classDiagram
Class01 <|-- AveryLongClass : Cool
Class03 *-- Class04
Class05 o-- Class06
Class07 .. Class08
Class09 --> C2 : Where am i?
Class09 --* C3
Class09 --|> Class07
Class07 : equals()
Class07 : Object[] elementData
Class01 : size()
Class01 : int chimp
Class01 : int gorilla
Class08 <--> C2: Cool label

View file

@ -9,7 +9,7 @@
<!-- else -->
<!-- TODO: currently `lein npm install` fails to build packages on all platforms, and
fails SILENTLY. Consequently setting js-from to local is not advised. Investigting. -->
<!-- script "vendor/mermaid/dist/mermaid.js" %}
<!-- script "vendor/mermaid/dist/mermaid.js" %} -->
<!-- endifequal -->
{% endblock %}