Inital commit

This commit is contained in:
2023-03-09 00:38:30 +01:00
commit 56fa5970af
3273 changed files with 537628 additions and 0 deletions

2
samples/doc_v1/doc.yaml Normal file
View File

@@ -0,0 +1,2 @@
doc: 'doc'
templates: 'templates'

View File

@@ -0,0 +1,3 @@
title: dokytree Documentation
templates:
node: '@index'

View File

@@ -0,0 +1,5 @@
dokytree is a documentation system.
It is intended to build a node tree document based on yaml file in directory tree.
Pages are rendred with pugjs templates.
You can add addition md, adoc, txt, ... files to extend your documentation.

View File

@@ -0,0 +1,4 @@
index: 1
title: About
headfiles:
- 01.md

View File

@@ -0,0 +1,54 @@
Document is structured as nodes.
The doc object is the root node.
Nodes contains child nodes and items.
```
root
|-nodes
| |-node
| | |-nodes
| | | |-nodes
| | | |-items
| | |-items
| | |-item1
| |-node
| |-nodes
| | |-nodes
| | |-items
| |-items
| |-item1
|-items
```
### Node
``` json
node: {
name: '', // ReadOnly: File name
title: '', // Optional: Title (default: name)
toc: true, // Optional: Show in TOC (default: true)
book: true, // Optional: Include in Book (default: true)
url: '/', // ReadOnly: Node URL
templates: { // Optional
node: '@node', // Optional: Node template (default: @node)
items: '@item', // Optional: Items template (default: @item)
},
parent: null, // ReadOnly: Parent node
nodes: [], // ReadOnly: Child nodes
items: [], // ReadOnly: Items
getNode: (name) => {}, // Function: Get child node by name
getItem: (name) => {}, // Function: Get item by name
}
```
### Item
``` json
item: {
name: '', // Optional: Name
title: '', // Optional: Title (default: name)
toc: false, // Optional: Show in TOC (default: false)
book: true, // Optional: Include in Book (default: true)
url: '', // ReadOnly: Item URL
data: {}, // ReadOnly: Item Data
}
```

View File

@@ -0,0 +1,4 @@
index: 4
title: Document
files:
- 01.md

View File

@@ -0,0 +1,17 @@
```
doc
|- doc/ # Documentation tree
| |- category/ # Child node
| | |- _index.yaml # Node information
| | |- item1.yaml # Item data
| | |- item1.01.md # Item extra file
| |- _index.yaml # Node information
| |- _index.01.md # Node extra file
| |- _index.01.txt # Node extra file
| |- _index.01.pug # Node extra file
| |- _index.01.svg # Node extra file
|- templates/ # Pug Templates
| |- template1.pug # A pugjs template
| |- template2.pug # A pugjs template
|- doc.yaml # Documentation main file
```

View File

@@ -0,0 +1,3 @@
title: Tree
headfiles:
- 01.md

View File

@@ -0,0 +1,4 @@
``` yaml
doc: 'doc' # Optional: Documentation directory
templates: 'templates' # Optional: Templates directory
```

View File

@@ -0,0 +1,3 @@
title: doc.yaml
files:
- 01.md

View File

@@ -0,0 +1,15 @@
``` yaml
index: 1 # Optional: Override node index
title: Documentation # Optional: Override node title
toc: true # Optional: Show in TOC (default: true)
book: true # Optional: Include in book (default: true)
templates: # Optional: Templates
node: 'template1' # Optional: Node template (default: @node)
items: 'template2' # Optional: Items template (default: @item)
headfiles: # Optional: Additional file on top of node document
- 01.md
files: # Optional: Additional file in node document
- 01.md
footfiles:
- 01.md # Optional: Additional file at bootom of node document
```

View File

@@ -0,0 +1,3 @@
title: _index.yaml
files:
- 01.md

View File

@@ -0,0 +1,9 @@
``` yaml
name: Item1 # Optional: Override name of item
headfiles: # Optional: Additional file on top of node document
- 01.md
files: # Optional: Additional file in node document
- 01.md
footfiles: # Optional: Additional file at bootom of node document
- 01.md
```

View File

@@ -0,0 +1,3 @@
title: item.yaml
files:
- 01.md

View File

@@ -0,0 +1,9 @@
You can store additionnal files related to the yaml file.
As exemple, with _index.yaml, you can add _index.01.md or _index.01.svg.
You can use the same method with item.yaml files.
Thoses files can be added as headfile, file or footfiles just using 01.md or 01.svg.
### Supported extentions
Text: txt adoc
Parsed: md html pug
Images: svg png jpg jpeg gif bmp

View File

@@ -0,0 +1,3 @@
title: .file.ext
files:
- 01.md

View File

@@ -0,0 +1,19 @@
``` pug
div#HEADFILES // Headfiles container
// Your pugjs code
div#FILES // Files container
// Your pugjs code
div#FOOTFILES // Footfiles container
```
### Informations
pugjs documentation can be found here :
[https://pugjs.org/](https://pugjs.org/)
When you use pugjs with dokytree, you have some additional objets :
```
doc // The document root node
node // The current node
compareIP // A helper to sort IP v4
```

View File

@@ -0,0 +1,3 @@
title: template.pug
files:
- 01.md

View File

@@ -0,0 +1,4 @@
index: 3
title: Structure
templates:
- node: '@overview'

View File

@@ -0,0 +1,14 @@
```
node app.js [args] docfile.yaml
-p | --port Set listen port (default : 3000)
-b | --bind Set listen ip (default : 127.0.0.1)
```
This command start the documentation server.
You can use it to view your changes.
Then you can click on book link and print your doc as pdf.
### Additional tools
VSCode - Editor for your documentation.
Chromium or derived browser - To print PDF with converted link.
Draw.io - Editor for schemas.

View File

@@ -0,0 +1,4 @@
index: 2
title: Usage
headfiles:
- 01.md