-- lua/notex/document.lua local lyaml = require("lyaml") local M = {} function M.parse(file_content) local yaml_part, content_part = file_content:match("\n?^---\n(.-?)\n---\n(.*)") if not yaml_part then return { type = "note", properties = {}, content = file_content, } end local properties = lyaml.load(yaml_part) local doc_type = properties.type or "note" properties.type = nil return { type = doc_type, properties = properties, content = content_part, } end return M