Actions25
- Append Block
- Create Document
- Create Notebook
- Delete Block
- Execute SQL Query
- Export Document Markdown
- Get Block Attributes
- Get Block Kramdown
- Get Child Blocks
- Get Document ID by Path
- Get Document Path by ID
- Insert Block
- List Documents in Notebook
- List Files in Directory
- Move Document
- Prepend Block
- Push Error Message
- Push Message
- Remove Document
- Remove Notebook
- Rename Document
- Rename Notebook
- Render Sprig Template
- Set Block Attributes
- Update Block
Overview
The node integrates with the SiYuan API to perform a variety of content and document management operations within the SiYuan note-taking and knowledge management system. Specifically, the "Insert Block" operation allows users to add a new block of content (in Markdown or HTML format) inside a specified parent block, positioning it either before or after an existing sibling block or as the first/last child.
This operation is useful when you want to programmatically insert structured content into documents or blocks in SiYuan, such as adding paragraphs, lists, or other formatted content at precise locations within your notes. For example, you might insert a new paragraph after a specific section or add a list item before another block.
Properties
| Name | Meaning |
|---|---|
| Parent Block ID | The unique identifier of the parent block (e.g., a document or container block) where the new block will be inserted. |
| Content (Markdown/HTML) | The text content and formatting for the new block, provided in Markdown or HTML. |
| Previous Block ID | (Optional) The ID of an existing block after which the new block should be inserted. |
| Next Block ID | (Optional) The ID of an existing block before which the new block should be inserted; used if Previous Block ID is empty. |
Output
The output JSON contains the response from the SiYuan API corresponding to the insertion operation. Typically, this includes metadata about the newly created block, such as its unique ID and any relevant attributes returned by the API.
If the operation succeeds, the output JSON will reflect the details of the inserted block. If no data is returned, a success confirmation object { success: true } is provided instead.
The node does not output binary data.
Dependencies
- Requires an active connection to the SiYuan API via an API URL and an API authentication token.
- The user must configure credentials in n8n that provide these two pieces of information.
- The node depends on the bundled
SiYuanClientlibrary to communicate with the SiYuan API.
Troubleshooting
- Missing Credentials: If the API URL or token is not set, the node will throw a "Credentials missing!" error. Ensure that valid credentials are configured.
- Invalid Block IDs: Providing incorrect or non-existent
parentBlockId,previousBlockId, ornextBlockIdmay cause the API to reject the request or fail silently. Verify block IDs exist in your SiYuan workspace. - Content Format Issues: The
blockDatamust be valid Markdown or HTML. Improperly formatted content could lead to unexpected rendering or errors. - Operation Not Supported: If an unsupported operation name is provided, the node throws an error indicating the operation is unsupported.
- API Errors: Network issues or API-side errors will propagate as exceptions. Check connectivity and API status.
Links and References
- SiYuan Official Website
- SiYuan API Documentation
- Markdown Guide - for formatting block content