Skip to content

API Reference parrot.interfaces.obsidian.parser

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot.interfaces.obsidian.parser

View source

Obsidian-flavored markdown parsing into :class:ObsidianNote models.

Implements FEAT-392 Module 1 (relocated to the shared interface package so the toolkit, the vault loader and the wikitoolkit vault scanner all parse notes identically): python-frontmatter for YAML frontmatter extraction and marko with a custom inline element for [[wikilinks]] / ![[embeds]]. Inline #tags are collected from raw-text nodes only (code blocks and link targets never produce tags), callout blocks are preserved verbatim in the note body, and dataview queries are captured as raw text.

Parsing is pure and synchronous — no I/O happens here.

Alias ObsidianCanvas

Re-exported from parrot.interfaces.obsidian.models.ObsidianCanvas.

Alias ObsidianCanvasCard

Re-exported from parrot.interfaces.obsidian.models.ObsidianCanvasCard.

Attribute ObsidianExtension

Alias ObsidianLink

Re-exported from parrot.interfaces.obsidian.models.ObsidianLink.

Alias ObsidianNote

Re-exported from parrot.interfaces.obsidian.models.ObsidianNote.

Class ObsidianNoteParser

Parse raw Obsidian markdown text into :class:ObsidianNote models.

The parser is stateless and reusable; one instance can parse any number of notes (a single marko.Markdown instance is reused).

Method ObsidianNoteParser.parse

Parse one note.

parse(raw: str, rel_path: str | Path) -> ObsidianNote

Parameter Type Default Description
raw str Full file text including any YAML frontmatter block.
rel_path str | Path Vault-relative path of the note (used for the title fallback and stored on the model).

Returns: ObsidianNote — The parsed :class:ObsidianNote. Invalid YAML frontmatter is the whole text becomes the body and frontmatter is empty (per the FEAT-392 robustness requirement).

Class WikiLinkElement

marko inline element for [[target#heading|alias]] / ![[embed]].

Parameter Type Default Description
match re.Match

Attributes:

Attribute Type Description
is_embed bool
target str
heading Optional[str]
alias Optional[str]

Attribute logger

Function parse_canvas

Parse an Obsidian .canvas JSON file.

parse_canvas(raw_json: str, rel_path: str | Path) -> ObsidianCanvas

Parameter Type Default Description
raw_json str The canvas file content (JSON Canvas format).
rel_path str | Path Vault-relative path of the canvas file.

Returns: ObsidianCanvas — The parsed :class:ObsidianCanvas with cards and connections.

Raises:

  • ValueError — If the file is not valid JSON or not an object.

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally