Initial vibecoded proof of concept
This commit is contained in:
parent
74812459af
commit
461318a656
61 changed files with 13306 additions and 0 deletions
28
lua/notex/document.lua
Normal file
28
lua/notex/document.lua
Normal file
|
@ -0,0 +1,28 @@
|
|||
-- 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
|
Loading…
Add table
Add a link
Reference in a new issue