title: Publishing Workflow sidebar_label: Workflow description: Post, patch, drafts, pulling, and syncing documents. sidebar_position: 4#
Publishing Workflow#
Converting Notes to Leaflet Documents#
Noteleaf converts markdown notes to leaflet's rich text block format:
Supported Markdown Features:
- Headers (
#,##,###, etc.) - Paragraphs
- Bold (
**bold**) - Italic (
*italic*) - Code (
inline code) - Strikethrough (
~~text~~) - Links (
[text](url)) - Code blocks (
```language ... ```) - Blockquotes (
> quote) - Lists (ordered and unordered)
- Horizontal rules (
---)
Conversion Process:
- Parse markdown into AST (abstract syntax tree)
- Convert AST nodes to leaflet block records
- Process text formatting into facets
- Validate document structure
- Upload to leaflet.pub via AT Protocol
Creating a New Document#
Publish a local note as a new leaflet document:
noteleaf pub post 123
This:
- Converts the note to leaflet format
- Creates a new document on leaflet.pub
- Links the note to the document (stores the rkey)
- Marks the note as published
Create as draft:
noteleaf pub post 123 --draft
Drafts are saved to leaflet but not publicly visible until you publish them.
Preview before posting:
noteleaf pub post 123 --preview
Shows what the document will look like without actually posting.
Validate conversion:
noteleaf pub post 123 --validate
Checks if the markdown converts correctly to leaflet format without posting.
Save to file:
noteleaf pub post 123 --preview --output document.json
noteleaf pub post 123 --preview --output document.txt --plaintext
Updating Published Documents#
Update an existing leaflet document from a local note:
noteleaf pub patch 123
Requirements:
- Note must have been previously posted or pulled from leaflet
- Note must have a leaflet record key (rkey) in the database
Preserve draft/published status: The patch command maintains the document's current status. If it's published, it stays published. If it's a draft, it stays a draft.
Preview changes:
noteleaf pub patch 123 --preview
Validate before patching:
noteleaf pub patch 123 --validate
Managing Drafts#
Create as draft:
noteleaf pub post 123 --draft
Update draft:
noteleaf pub patch 123
List drafts:
noteleaf pub list --draft
Publish a draft: Edit the draft on leaflet.pub or use the API to change status (command support coming in future versions).
Pulling Documents from Leaflet#
Sync leaflet documents to local notes:
noteleaf pub pull
This:
- Authenticates with leaflet.pub
- Fetches all documents in your repository
- Creates new notes for documents not yet synced
- Updates existing notes that have changed
Matching logic: Notes are matched to leaflet documents by their record key (rkey) stored in the database. If a document doesn't have a corresponding note, a new one is created. If it does, the note is updated only if the content has changed (using CID for change detection).