Skip to content

Commit 8076a89

Browse files
committed
Release v0.14.0: Add navigation blocks (TOC, Anchors, Siblings) and code blocks
- Add toc_block() for automatic table of contents - Add anchors_block() for related documents and backlinks - Add siblings_block() for same-level document navigation - Add code_block() for syntax-highlighted code snippets - Headings now auto-generate UIDs for TOC navigation - Add 17 comprehensive tests - Add examples: document_navigation_blocks.py, document_with_code_blocks.py - Update documentation (guides and API reference) - All code in English per project standards
1 parent 5ded927 commit 8076a89

12 files changed

Lines changed: 1177 additions & 11 deletions

CHANGELOG.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,42 @@
11
# Changelog
22

3+
## [0.14.0] - 2025-10-24
4+
5+
### Added
6+
7+
- **📑 TOC Block**: Automatic table of contents generation
8+
- `toc_block()` - Creates interactive document outline
9+
- Automatically indexes all headings (h1-h6)
10+
- Clickable navigation links to document sections
11+
- Auto-updates when document content changes
12+
13+
- **🔗 Anchors Block**: Related documents and backlinks
14+
- `anchors_block()` - Displays document relationships
15+
- Shows documents that this document links to
16+
- Shows backlinks (documents linking to this one)
17+
- Visualizes knowledge graph connections
18+
19+
- **📄 Siblings Block**: Same-level document navigation
20+
- `siblings_block()` - Shows sibling documents
21+
- Displays documents in same folder/collection
22+
- Helps navigate series of related pages
23+
- Useful for guides and tutorials
24+
25+
- **💻 Code Block**: Syntax-highlighted code snippets
26+
- `code_block(code, language)` - Display code with highlighting
27+
- Support for Python, JavaScript, TypeScript, Java, C++, Go, Rust, SQL, Bash, and many more
28+
- Multiline code support
29+
- Optional language specification
30+
31+
### Changed
32+
33+
- **🔧 Headings now auto-generate UIDs**: All headings created with `heading()` now automatically get unique IDs for TOC navigation support
34+
- UIDs are 12-character alphanumeric strings (e.g., "sEeaN9ddIDsL")
35+
- Required for TOC block to create working navigation links
36+
- No breaking changes - UIDs added automatically
37+
38+
---
39+
340
## [0.13.0] - 2025-10-23
441

542
### Changed

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -881,17 +881,22 @@ milestone_id = milestones.milestones[0].id
881881
|-----------|-------------|---------|
882882
| `text` | Text content with optional marks | `{"type": "text", "text": "..."}` |
883883
| `paragraph` | Paragraph block | `{"type": "paragraph", "content": [...]}` |
884-
| `heading` | Heading (H1-H6) | `{"type": "heading", "attrs": {"level": 1}}` |
884+
| `heading` | Heading (H1-H6) with UID | `{"type": "heading", "attrs": {"level": 1, "uid": "..."}}` |
885885
| `bulletList` | Unordered list | `{"type": "bulletList", "content": [...]}` |
886886
| `orderedList` | Numbered list | `{"type": "orderedList", "content": [...]}` |
887887
| `listItem` | List item | `{"type": "listItem", "content": [...]}` |
888888
| `blockquote` | Blockquote for quotes/callouts | `{"type": "blockquote", "content": [...]}` |
889+
| `details` | Collapsible section | `{"type": "details", "content": [...]}` |
889890
| `extension-table` | Table with rows | `{"type": "extension-table", "attrs": {"uid": "..."}, "content": [...]}` |
890891
| `tableRow` | Table row with cells/headers | `{"type": "tableRow", "attrs": {"showRowNumbers": false}, "content": [...]}` |
891892
| `tableCell` | Table data cell | `{"type": "tableCell", "attrs": {"colspan": 1, "rowspan": 1}, "content": [...]}` |
892893
| `tableHeader` | Table header cell (th) | `{"type": "tableHeader", "attrs": {"colspan": 1, "rowspan": 1}, "content": [...]}` |
893894
| `horizontalRule` | Horizontal divider line | `{"type": "horizontalRule"}` |
894895
| `custom-mention` | Mention user/doc/task/milestone | `{"type": "custom-mention", "attrs": {"uid": "...", "custom": 1, "inline": true, "data": {"item": {"id": "...", "kind": "User"}}}}` |
896+
| `image-block` | Embedded image | `{"type": "image-block", "attrs": {"uid": "...", "custom": 1}, "content": [...]}` |
897+
| `files` | File attachments | `{"type": "files", "attrs": {"uid": "...", "custom": 1}, "content": [...]}` |
898+
| `doc-siblings` | Navigation blocks (TOC/Anchors/Siblings) | `{"type": "doc-siblings", "attrs": {"uid": "...", "custom": 1}, "content": [...]}` |
899+
| `codeBlock` | Code with syntax highlighting | `{"type": "codeBlock", "attrs": {"uid": "...", "language": "python"}, "content": [...]}` |
895900

896901
### Marks
897902

docs-site/docs/guides/document-structure-helpers.md

Lines changed: 166 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -655,18 +655,175 @@ content = [
655655
client.replace_json_document("document_id", content)
656656
```
657657

658+
## Navigation Blocks
659+
660+
### TOC Block - Table of Contents
661+
662+
Automatically generate a table of contents from all headings in the document:
663+
664+
```python
665+
from vaiz import toc_block, heading, paragraph
666+
667+
content = [
668+
# Add TOC at the beginning
669+
toc_block(),
670+
671+
heading(1, "Introduction"),
672+
paragraph("Welcome to our documentation"),
673+
674+
heading(2, "Getting Started"),
675+
paragraph("First steps..."),
676+
677+
heading(2, "Advanced Topics"),
678+
paragraph("Deep dive into features...")
679+
]
680+
681+
client.replace_json_document(document_id, content)
682+
```
683+
684+
**Features:**
685+
- Automatically indexes all headings (h1-h6)
686+
- Creates clickable navigation links
687+
- Shows hierarchical document structure
688+
- Updates automatically when content changes
689+
690+
**Note:** Headings created with `heading()` automatically get unique IDs required for TOC navigation.
691+
692+
### Anchors Block - Related Documents
693+
694+
Display related documents and backlinks:
695+
696+
```python
697+
from vaiz import anchors_block, heading, paragraph
698+
699+
content = [
700+
anchors_block(), # Shows related documents
701+
702+
heading(1, "Main Content"),
703+
paragraph("Content here...")
704+
]
705+
706+
client.replace_json_document(document_id, content)
707+
```
708+
709+
**Shows:**
710+
- Documents that this document links to
711+
- Documents that link to this one (backlinks)
712+
- Related documents from the space
713+
- Knowledge graph connections
714+
715+
### Siblings Block - Same-Level Documents
716+
717+
Display documents at the same hierarchical level:
718+
719+
```python
720+
from vaiz import siblings_block, heading, paragraph
721+
722+
content = [
723+
siblings_block(), # Shows sibling documents
724+
725+
heading(1, "Current Page"),
726+
paragraph("Sibling pages shown above...")
727+
]
728+
729+
client.replace_json_document(document_id, content)
730+
```
731+
732+
**Useful for:**
733+
- Series of tutorial pages
734+
- Multi-part guides
735+
- Related documentation pages
736+
- Folder/collection navigation
737+
738+
### Code Block - Syntax Highlighting
739+
740+
Display code with syntax highlighting:
741+
742+
```python
743+
from vaiz import code_block, heading, paragraph
744+
745+
python_code = '''def hello():
746+
print("Hello, World!")
747+
return True'''
748+
749+
content = [
750+
heading(1, "Code Example"),
751+
paragraph("Here's a Python function:"),
752+
753+
code_block(
754+
code=python_code,
755+
language="python"
756+
),
757+
758+
paragraph("This code demonstrates a simple function.")
759+
]
760+
761+
client.replace_json_document(document_id, content)
762+
```
763+
764+
**Supported Languages:**
765+
- Python, JavaScript, TypeScript, Java, C++, Go, Rust
766+
- SQL, JSON, YAML, XML, HTML, CSS
767+
- Bash, Shell, PowerShell
768+
- And 50+ more languages
769+
770+
**Features:**
771+
- Syntax highlighting
772+
- Multiline code support
773+
- Optional language specification
774+
- Automatic formatting
775+
776+
### Complete Navigation Example
777+
778+
Combine all navigation blocks:
779+
780+
```python
781+
from vaiz import (
782+
toc_block, anchors_block, siblings_block,
783+
heading, paragraph, code_block, bullet_list
784+
)
785+
786+
content = [
787+
# All navigation blocks at the top
788+
toc_block(),
789+
anchors_block(),
790+
siblings_block(),
791+
792+
# Main content
793+
heading(1, "API Documentation"),
794+
795+
paragraph("This guide explains how to use our API."),
796+
797+
heading(2, "Authentication"),
798+
bullet_list(
799+
"Get API key from settings",
800+
"Set environment variable",
801+
"Initialize client"
802+
),
803+
804+
heading(2, "Example"),
805+
code_block(
806+
code='client = VaizClient(api_key="...")',
807+
language="python"
808+
)
809+
]
810+
811+
client.replace_json_document(document_id, content)
812+
```
813+
658814
## Supported Elements
659815

660816
All helper functions create nodes compatible with the document editor:
661817

662818
### Nodes
663819
-`text()` - Text with formatting marks
664820
-`paragraph()` - Paragraph blocks
665-
-`heading(level)` - Headings (H1-H6)
821+
-`heading(level)` - Headings (H1-H6) with automatic UID
666822
-`bullet_list()` - Unordered lists
667823
-`ordered_list()` - Numbered lists
668824
-`list_item()` - List items with content
669825
-`blockquote()` - Blockquotes for quotes and callouts
826+
-`details()` - Collapsible sections
670827
-`table()` - Tables with rows and cells
671828
-`table_row()` - Table row
672829
-`table_cell()` - Table cell (use for both data and headers)
@@ -676,6 +833,14 @@ All helper functions create nodes compatible with the document editor:
676833
-`mention_task()` - Reference a task
677834
-`mention_milestone()` - Reference a milestone
678835
-`mention(id, kind)` - Generic mention
836+
-`image_block()` - Embed images
837+
-`files_block()` - Attach files
838+
839+
### Navigation & Special Blocks
840+
-`toc_block()` - Automatic table of contents
841+
-`anchors_block()` - Related documents and backlinks
842+
-`siblings_block()` - Same-level documents navigation
843+
-`code_block()` - Code with syntax highlighting
679844

680845
### Marks (Formatting)
681846
-`bold=True` - Bold text

docs-site/docs/patterns/ready-to-run.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ The SDK includes a collection of ready-to-run examples in the [`/examples`](http
4545
- **`advanced_document_workflows.py`** - Complex document scenarios
4646
- **`mention_blocks.py`** - Create documents with user, task, document, and milestone mentions
4747
- **`advanced_mention_usage.py`** - Advanced usage of mentions in tables, lists, and complex documents
48+
- **`document_navigation_blocks.py`** - TOC, Anchors, and Siblings navigation blocks
49+
- **`document_with_code_blocks.py`** - Code blocks with syntax highlighting
4850

4951
## Custom Fields
5052

docs-site/docusaurus.config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,8 @@ const config: Config = {
206206
},
207207
items: [
208208
{
209-
label: "v0.13.0",
210-
href: "https://pypi.org/project/vaiz-sdk/0.13.0/",
209+
label: "v0.14.0",
210+
href: "https://pypi.org/project/vaiz-sdk/0.14.0/",
211211
position: "left",
212212
},
213213
{

0 commit comments

Comments
 (0)