Compare commits
No commits in common. "cd3c5dac83c3a238cdefa24ceede01a1b4047b2c" and "7b55d2b37d63565ff32991c0205b6bfa99da0b20" have entirely different histories.
cd3c5dac83
...
7b55d2b37d
33
README.md
33
README.md
|
|
@ -22,17 +22,11 @@ Or to create a new note:
|
||||||
typst init @local/notes <directory>
|
typst init @local/notes <directory>
|
||||||
```
|
```
|
||||||
|
|
||||||
A useful alias to generate a new note *in the current directory*:
|
|
||||||
|
|
||||||
```
|
|
||||||
alias new-note='TMP_ENV="$(mktemp -d)" && typst init @local/notes "${TMP_ENV}/note" 2>/dev/null && mv -i ${TMP_ENV}/note/* . && rm -r ${TMP_ENV} && mv -i main.typ '
|
|
||||||
```
|
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
### Graph
|
### Graph
|
||||||
|
|
||||||
This package import gviz and pintora to render graphs:
|
This package import gviz and can render dot graphs:
|
||||||
|
|
||||||
```
|
```
|
||||||
\```dot-render
|
\```dot-render
|
||||||
|
|
@ -61,23 +55,6 @@ c -- a;
|
||||||
\```
|
\```
|
||||||
```
|
```
|
||||||
|
|
||||||
```
|
|
||||||
\```pintora
|
|
||||||
mindmap
|
|
||||||
@param layoutDirection TB
|
|
||||||
* Pintora diagrams
|
|
||||||
** UML Diagrams
|
|
||||||
*** Sequence Diagram
|
|
||||||
*** Activity Diagram
|
|
||||||
*** Component Diagram
|
|
||||||
** Non-UML Diagrams
|
|
||||||
*** Entity Relationship Diagram
|
|
||||||
*** Mind Map
|
|
||||||
*** Gantt Diagram
|
|
||||||
*** DOT Diagram
|
|
||||||
\```
|
|
||||||
```
|
|
||||||
|
|
||||||
### Todo
|
### Todo
|
||||||
|
|
||||||
Todos can be defined with the `todo` function. In addition to being highlighted, the unresolved totos are listed at the end of the generated document.
|
Todos can be defined with the `todo` function. In addition to being highlighted, the unresolved totos are listed at the end of the generated document.
|
||||||
|
|
@ -98,14 +75,6 @@ To hid todos, you can add this line at the top of the document:
|
||||||
#show-todos.update(_ => false)
|
#show-todos.update(_ => false)
|
||||||
```
|
```
|
||||||
|
|
||||||
### Templates
|
|
||||||
|
|
||||||
Parameters can be passed to the template depending on the usage. The `doc_type` parameter indicate the specific template to use:
|
|
||||||
|
|
||||||
```
|
|
||||||
#show: notes-template.with(doc_type: "research_journal", keywords: ("ipsum",))
|
|
||||||
```
|
|
||||||
|
|
||||||
## TODO:
|
## TODO:
|
||||||
|
|
||||||
- biblio
|
- biblio
|
||||||
|
|
|
||||||
71
lib.typ
71
lib.typ
|
|
@ -1,5 +1,4 @@
|
||||||
#import "@preview/gviz:0.1.0"
|
#import "@preview/gviz:0.1.0": *
|
||||||
#import "@preview/pintorita:0.1.0"
|
|
||||||
|
|
||||||
#let todo-list = state("todo-list",())
|
#let todo-list = state("todo-list",())
|
||||||
#let show-todos = state("show-todos", true)
|
#let show-todos = state("show-todos", true)
|
||||||
|
|
@ -23,62 +22,12 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#let note_header(title: "Notes", ..args) = {
|
#let notes-template(doc) = [
|
||||||
[ = #title ]
|
#show raw.where(lang: "dot-render"): it => render-image(it.text)
|
||||||
}
|
#show raw.where(lang: "digraphLR"): it => render-image("digraph mygraph { rankdir=\"LR\";" + it.text + "}")
|
||||||
|
#show raw.where(lang: "digraphTB"): it => render-image("digraph mygraph { rankdir=\"TB\";" + it.text + "}")
|
||||||
#let research_journal_header(title: "Research Journal", ..args) = {
|
#show raw.where(lang: "graphLR"): it => render-image("graph mygraph { rankdir=\"TB\";" + it.text + "}")
|
||||||
show link: underline
|
#show raw.where(lang: "graphTB"): it => render-image("graph mygraph { rankdir=\"TB\";" + it.text + "}")
|
||||||
show heading.where(level: 2): it => {
|
#doc
|
||||||
it
|
#todos()
|
||||||
v(5pt, weak: true)
|
]
|
||||||
line(length: 100%)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Setup level3 headings
|
|
||||||
show heading.where(level: 3): it => {
|
|
||||||
block(smallcaps(it.body))
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set Make title
|
|
||||||
align(center, text(size: 20pt, font: "Indie Flower", title))
|
|
||||||
v(2em)
|
|
||||||
}
|
|
||||||
|
|
||||||
#let notes-template(title: none, doc_type: none, keywords: (), doc) = {
|
|
||||||
show raw.where(lang: "dot-render"): it => gviz.render-image(it.text)
|
|
||||||
show raw.where(lang: "digraphLR"): it => gviz.render-image("digraph mygraph { rankdir=\"LR\";" + it.text + "}")
|
|
||||||
show raw.where(lang: "digraphTB"): it => gviz.render-image("digraph mygraph { rankdir=\"TB\";" + it.text + "}")
|
|
||||||
show raw.where(lang: "graphLR"): it => gviz.render-image("graph mygraph { rankdir=\"TB\";" + it.text + "}")
|
|
||||||
show raw.where(lang: "graphTB"): it => gviz.render-image("graph mygraph { rankdir=\"TB\";" + it.text + "}")
|
|
||||||
show raw.where(lang: "pintora"): it => pintorita.render(it.text)
|
|
||||||
|
|
||||||
// Make keywords bold
|
|
||||||
show: rest => {
|
|
||||||
for keyword in keywords {
|
|
||||||
rest = {
|
|
||||||
show keyword: set text(weight: "bold")
|
|
||||||
rest
|
|
||||||
}
|
|
||||||
}
|
|
||||||
rest
|
|
||||||
}
|
|
||||||
|
|
||||||
let args = (:)
|
|
||||||
for (arg, val) in ("title": title, "keywords": keywords) {
|
|
||||||
if val != none {
|
|
||||||
args.insert(arg, val)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if doc_type == "notes" {
|
|
||||||
note_header(..args)
|
|
||||||
} else if doc_type == "research_journal" {
|
|
||||||
research_journal_header(..args)
|
|
||||||
} else {
|
|
||||||
assert.eq(doc_type, none, message: "unknown document type: " + doc_type)
|
|
||||||
}
|
|
||||||
|
|
||||||
doc
|
|
||||||
|
|
||||||
todos()
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
#import "@local/notes:0.0.1": *
|
#import "@local/notes:0.0.1": *
|
||||||
#show: notes-template.with(doc_type: "research_journal", keywords: ("ipsum",))
|
#show: notes-template
|
||||||
|
|
||||||
```dot-render
|
```dot-render
|
||||||
digraph mygraph {
|
digraph mygraph {
|
||||||
|
|
@ -23,18 +23,3 @@ c -- a;
|
||||||
```
|
```
|
||||||
|
|
||||||
Lorem ipsum dolore #todo[sit] amet
|
Lorem ipsum dolore #todo[sit] amet
|
||||||
|
|
||||||
```pintora
|
|
||||||
mindmap
|
|
||||||
@param layoutDirection TB
|
|
||||||
* Pintora diagrams
|
|
||||||
** UML Diagrams
|
|
||||||
*** Sequence Diagram
|
|
||||||
*** Activity Diagram
|
|
||||||
*** Component Diagram
|
|
||||||
** Non-UML Diagrams
|
|
||||||
*** Entity Relationship Diagram
|
|
||||||
*** Mind Map
|
|
||||||
*** Gantt Diagram
|
|
||||||
*** DOT Diagram
|
|
||||||
```
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue