Compare commits
3 Commits
7b55d2b37d
...
cd3c5dac83
| Author | SHA1 | Date |
|---|---|---|
|
|
cd3c5dac83 | |
|
|
60a3671a68 | |
|
|
1881970027 |
33
README.md
33
README.md
|
|
@ -22,11 +22,17 @@ Or to create a new note:
|
|||
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
|
||||
|
||||
### Graph
|
||||
|
||||
This package import gviz and can render dot graphs:
|
||||
This package import gviz and pintora to render graphs:
|
||||
|
||||
```
|
||||
\```dot-render
|
||||
|
|
@ -55,6 +61,23 @@ 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
|
||||
|
||||
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.
|
||||
|
|
@ -75,6 +98,14 @@ To hid todos, you can add this line at the top of the document:
|
|||
#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:
|
||||
|
||||
- biblio
|
||||
|
|
|
|||
71
lib.typ
71
lib.typ
|
|
@ -1,4 +1,5 @@
|
|||
#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 show-todos = state("show-todos", true)
|
||||
|
|
@ -22,12 +23,62 @@
|
|||
}
|
||||
}
|
||||
|
||||
#let notes-template(doc) = [
|
||||
#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 + "}")
|
||||
#show raw.where(lang: "graphLR"): it => render-image("graph mygraph { rankdir=\"TB\";" + it.text + "}")
|
||||
#show raw.where(lang: "graphTB"): it => render-image("graph mygraph { rankdir=\"TB\";" + it.text + "}")
|
||||
#doc
|
||||
#todos()
|
||||
]
|
||||
#let note_header(title: "Notes", ..args) = {
|
||||
[ = #title ]
|
||||
}
|
||||
|
||||
#let research_journal_header(title: "Research Journal", ..args) = {
|
||||
show link: underline
|
||||
show heading.where(level: 2): it => {
|
||||
it
|
||||
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": *
|
||||
#show: notes-template
|
||||
#show: notes-template.with(doc_type: "research_journal", keywords: ("ipsum",))
|
||||
|
||||
```dot-render
|
||||
digraph mygraph {
|
||||
|
|
@ -23,3 +23,18 @@ c -- a;
|
|||
```
|
||||
|
||||
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