Skip to content

Commit 82c71d3

Browse files
committed
docs: Add detailed API reference for navigation and code blocks
- Add TOC block section with structure and examples - Add Anchors block section with usage details - Add Siblings block section with use cases - Add Code block section with language support - Include JSON structure and helper examples for each block
1 parent 8076a89 commit 82c71d3

1 file changed

Lines changed: 197 additions & 0 deletions

File tree

docs-site/docs/api-reference/document-structure.md

Lines changed: 197 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -873,6 +873,203 @@ milestones = client.get_milestones()
873873
milestone_id = milestones.milestones[0].id
874874
```
875875

876+
## Navigation Blocks
877+
878+
### TOC Block
879+
880+
Table of Contents block that automatically generates an interactive document outline.
881+
882+
**Structure:**
883+
```json
884+
{
885+
"type": "doc-siblings",
886+
"attrs": {
887+
"uid": "uniqueId123",
888+
"custom": 1,
889+
"contenteditable": "false"
890+
},
891+
"content": [
892+
{
893+
"type": "text",
894+
"text": "{\"type\":\"toc\"}"
895+
}
896+
]
897+
}
898+
```
899+
900+
**Using Helper:**
901+
```python
902+
from vaiz import toc_block, heading, paragraph
903+
904+
content = [
905+
toc_block(),
906+
907+
heading(1, "Introduction"),
908+
paragraph("Content here..."),
909+
910+
heading(2, "Getting Started"),
911+
paragraph("More content...")
912+
]
913+
914+
client.replace_json_document(document_id, content)
915+
```
916+
917+
**Features:**
918+
- Automatically indexes all headings (h1-h6)
919+
- Creates clickable navigation links
920+
- Shows hierarchical structure
921+
- Updates automatically on changes
922+
923+
**Note:** Headings must have `uid` attribute for TOC navigation to work (automatically added by `heading()` helper).
924+
925+
---
926+
927+
### Anchors Block
928+
929+
Displays related documents and backlinks.
930+
931+
**Structure:**
932+
```json
933+
{
934+
"type": "doc-siblings",
935+
"attrs": {
936+
"uid": "uniqueId456",
937+
"custom": 1,
938+
"contenteditable": "false"
939+
},
940+
"content": [
941+
{
942+
"type": "text",
943+
"text": "{\"type\":\"anchors\"}"
944+
}
945+
]
946+
}
947+
```
948+
949+
**Using Helper:**
950+
```python
951+
from vaiz import anchors_block, heading, paragraph
952+
953+
content = [
954+
anchors_block(),
955+
956+
heading(1, "Documentation"),
957+
paragraph("Related documents shown above...")
958+
]
959+
960+
client.replace_json_document(document_id, content)
961+
```
962+
963+
**Shows:**
964+
- Documents that this document links to
965+
- Documents that link to this one (backlinks)
966+
- Related documents from the space
967+
- Knowledge graph connections
968+
969+
---
970+
971+
### Siblings Block
972+
973+
Displays documents at the same hierarchical level.
974+
975+
**Structure:**
976+
```json
977+
{
978+
"type": "doc-siblings",
979+
"attrs": {
980+
"uid": "uniqueId789",
981+
"custom": 1,
982+
"contenteditable": "false"
983+
},
984+
"content": [
985+
{
986+
"type": "text",
987+
"text": "{\"type\":\"siblings\"}"
988+
}
989+
]
990+
}
991+
```
992+
993+
**Using Helper:**
994+
```python
995+
from vaiz import siblings_block, heading, paragraph
996+
997+
content = [
998+
siblings_block(),
999+
1000+
heading(1, "Tutorial Part 2"),
1001+
paragraph("See related parts above...")
1002+
]
1003+
1004+
client.replace_json_document(document_id, content)
1005+
```
1006+
1007+
**Useful for:**
1008+
- Tutorial series navigation
1009+
- Multi-part guides
1010+
- Documentation pages at same level
1011+
- Folder/collection browsing
1012+
1013+
---
1014+
1015+
### Code Block
1016+
1017+
Code block with syntax highlighting.
1018+
1019+
**Structure:**
1020+
```json
1021+
{
1022+
"type": "codeBlock",
1023+
"attrs": {
1024+
"uid": "uniqueIdABC",
1025+
"language": "python"
1026+
},
1027+
"content": [
1028+
{
1029+
"type": "text",
1030+
"text": "def hello():\n print(\"Hello, World!\")"
1031+
}
1032+
]
1033+
}
1034+
```
1035+
1036+
**Using Helper:**
1037+
```python
1038+
from vaiz import code_block, heading, paragraph
1039+
1040+
python_code = '''def fibonacci(n):
1041+
if n <= 1:
1042+
return n
1043+
return fibonacci(n-1) + fibonacci(n-2)'''
1044+
1045+
content = [
1046+
heading(1, "Code Example"),
1047+
paragraph("Here's a Fibonacci function:"),
1048+
1049+
code_block(
1050+
code=python_code,
1051+
language="python"
1052+
)
1053+
]
1054+
1055+
client.replace_json_document(document_id, content)
1056+
```
1057+
1058+
**Supported Languages:**
1059+
- Python, JavaScript, TypeScript, Java, C++, Go, Rust
1060+
- SQL, JSON, YAML, XML, HTML, CSS, SCSS
1061+
- Bash, Shell, PowerShell
1062+
- Markdown, LaTeX
1063+
- And 50+ more languages
1064+
1065+
**Features:**
1066+
- Syntax highlighting based on language
1067+
- Multiline code support
1068+
- Optional language parameter
1069+
- Empty blocks supported
1070+
1071+
---
1072+
8761073
## Supported Elements
8771074

8781075
### Blocks

0 commit comments

Comments
 (0)