forked from dauxio/daux.io
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
342 additions
and
28 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,204 @@ | ||
--- | ||
title: Math, Diagrams and Flowcharts | ||
--- | ||
|
||
[TOC] | ||
|
||
## Math | ||
|
||
TeX expressions are rendered via [KaTex](https://katex.org/). | ||
|
||
```tex | ||
c = \\pm\\sqrt{a^2 + b^2}\\in\\RR | ||
``` | ||
|
||
```tex | ||
c = \\pm\\sqrt{a^2 + b^2}\\in\\RR | ||
``` | ||
|
||
|
||
```tex | ||
x = a_0 + \cfrac{1}{a_1 + \cfrac{1}{a_2 + \cfrac{1}{a_3+\cdots}}} | ||
``` | ||
|
||
```tex | ||
x = a_0 + \cfrac{1}{a_1 + \cfrac{1}{a_2 + \cfrac{1}{a_3+\cdots}}} | ||
``` | ||
|
||
## Diagrams and Flowcharts | ||
|
||
You can render Diagrams and Flowcharts using [mermaid](https://mermaid-js.github.io/mermaid/#/) | ||
|
||
### Flow | ||
|
||
```mermaid | ||
graph TD | ||
A[Hard] -->|Text| B(Round) | ||
B --> C{Decision} | ||
C -->|One| D[Result 1] | ||
C -->|Two| E[Result 2] | ||
``` | ||
|
||
```mermaid | ||
graph TD | ||
A[Hard] -->|Text| B(Round) | ||
B --> C{Decision} | ||
C -->|One| D[Result 1] | ||
C -->|Two| E[Result 2] | ||
``` | ||
|
||
### Sequence | ||
|
||
```mermaid | ||
sequenceDiagram | ||
Alice->>John: Hello John, how are you? | ||
loop Healthcheck | ||
John->>John: Fight against hypochondria | ||
end | ||
Note right of John: Rational thoughts! | ||
John-->>Alice: Great! | ||
John->>Bob: How about you? | ||
Bob-->>John: Jolly good! | ||
``` | ||
|
||
```mermaid | ||
sequenceDiagram | ||
Alice->>John: Hello John, how are you? | ||
loop Healthcheck | ||
John->>John: Fight against hypochondria | ||
end | ||
Note right of John: Rational thoughts! | ||
John-->>Alice: Great! | ||
John->>Bob: How about you? | ||
Bob-->>John: Jolly good! | ||
``` | ||
|
||
### Gantt | ||
|
||
```mermaid | ||
gantt | ||
section Section | ||
Completed :done, des1, 2014-01-06,2014-01-08 | ||
Active :active, des2, 2014-01-07, 3d | ||
Parallel 1 : des3, after des1, 1d | ||
Parallel 2 : des4, after des1, 1d | ||
Parallel 3 : des5, after des3, 1d | ||
Parallel 4 : des6, after des4, 1d | ||
``` | ||
|
||
```mermaid | ||
gantt | ||
section Section | ||
Completed :done, des1, 2014-01-06,2014-01-08 | ||
Active :active, des2, 2014-01-07, 3d | ||
Parallel 1 : des3, after des1, 1d | ||
Parallel 2 : des4, after des1, 1d | ||
Parallel 3 : des5, after des3, 1d | ||
Parallel 4 : des6, after des4, 1d | ||
``` | ||
|
||
|
||
### Class | ||
|
||
```mermaid | ||
classDiagram | ||
Class01 <|-- AveryLongClass : Cool | ||
<<interface>> Class01 | ||
Class09 --> C2 : Where am i? | ||
Class09 --* C3 | ||
Class09 --|> Class07 | ||
Class07 : equals() | ||
Class07 : Object[] elementData | ||
Class01 : size() | ||
Class01 : int chimp | ||
Class01 : int gorilla | ||
class Class10 { | ||
<<service>> | ||
int id | ||
size() | ||
} | ||
``` | ||
|
||
```mermaid | ||
classDiagram | ||
Class01 <|-- AveryLongClass : Cool | ||
<<interface>> Class01 | ||
Class09 --> C2 : Where am i? | ||
Class09 --* C3 | ||
Class09 --|> Class07 | ||
Class07 : equals() | ||
Class07 : Object[] elementData | ||
Class01 : size() | ||
Class01 : int chimp | ||
Class01 : int gorilla | ||
class Class10 { | ||
<<service>> | ||
int id | ||
size() | ||
} | ||
``` | ||
|
||
### State | ||
|
||
```mermaid | ||
stateDiagram-v2 | ||
[*] --> Still | ||
Still --> [*] | ||
Still --> Moving | ||
Moving --> Still | ||
Moving --> Crash | ||
Crash --> [*] | ||
``` | ||
|
||
```mermaid | ||
stateDiagram-v2 | ||
[*] --> Still | ||
Still --> [*] | ||
Still --> Moving | ||
Moving --> Still | ||
Moving --> Crash | ||
Crash --> [*] | ||
``` | ||
|
||
### Pie | ||
|
||
```mermaid | ||
pie | ||
"Dogs" : 386 | ||
"Cats" : 85 | ||
"Rats" : 15 | ||
``` | ||
|
||
```mermaid | ||
pie | ||
"Dogs" : 386 | ||
"Cats" : 85 | ||
"Rats" : 15 | ||
``` | ||
|
||
### Journey | ||
|
||
```mermaid | ||
journey | ||
title My working day | ||
section Go to work | ||
Make tea: 5: Me | ||
Go upstairs: 3: Me | ||
Do work: 1: Me, Cat | ||
section Go home | ||
Go downstairs: 5: Me | ||
Sit down: 3: Me | ||
``` | ||
|
||
```mermaid | ||
journey | ||
title My working day | ||
section Go to work | ||
Make tea: 5: Me | ||
Go upstairs: 3: Me | ||
Do work: 1: Me, Cat | ||
section Go home | ||
Go downstairs: 5: Me | ||
Sit down: 3: Me | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,46 @@ | ||
import { ready } from "./utils"; | ||
import { ready, loadJS, loadCSS } from "./utils"; | ||
|
||
ready(() => { | ||
const codeBlocks = document.querySelectorAll("pre > code:not(.hljs)"); | ||
const codeBlocks = document.querySelectorAll( | ||
"pre > code:not(.hljs, .katex)" | ||
); | ||
if (codeBlocks.length) { | ||
const head = document.getElementsByTagName("head")[0], | ||
script = document.createElement("script"); | ||
script.type = "text/javascript"; | ||
script.async = true; | ||
script.src = `${window.base_url}daux_libraries/highlight.pack.js`; | ||
script.onload = function(src) { | ||
loadJS(`${window.base_url}daux_libraries/highlight.pack.js`, () => { | ||
[].forEach.call(codeBlocks, window.hljs.highlightBlock); | ||
}; | ||
head.appendChild(script); | ||
}); | ||
} | ||
}); | ||
|
||
ready(() => { | ||
const codeBlocks = document.querySelectorAll("pre > code.katex"); | ||
if (codeBlocks.length) { | ||
loadCSS(`${window.base_url}daux_libraries/katex.min.css`); | ||
|
||
loadJS(`${window.base_url}daux_libraries/katex.min.js`, () => { | ||
[].forEach.call(codeBlocks, (/** @type {HTMLElement} */ e) => { | ||
const content = e.innerHTML; | ||
const p = document.createElement("p"); | ||
const span = document.createElement("span"); | ||
p.className = "katex-display"; | ||
p.appendChild(span); | ||
|
||
const pre = e.parentElement; | ||
pre.parentElement.insertBefore(p, pre); | ||
pre.parentElement.removeChild(pre); | ||
|
||
window.katex.render(content, span, { | ||
throwOnError: false | ||
}); | ||
}); | ||
}); | ||
} | ||
}); | ||
|
||
ready(() => { | ||
const mermaidBlocks = document.querySelectorAll("div.mermaid"); | ||
if (mermaidBlocks.length) { | ||
loadJS(`${window.base_url}daux_libraries/mermaid.min.js`, () => { | ||
window.mermaid.initialize({ startOnLoad: true }); | ||
}); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.