refactor: frontmatter for markdown;

feat: plugin for rendering images in markdown;
feat: pastify;
feat: markdown preview in browser
This commit is contained in:
2025-07-04 23:22:13 +03:00
parent 81d7b870f1
commit 7fc2e5c543
6 changed files with 126 additions and 17 deletions

View File

@@ -5,7 +5,6 @@ local i = ls.insert_node
local f = ls.function_node
local extras = require("luasnip.extras")
local rep = extras.rep
local timestamp = function()
return tostring(os.time())
end
@@ -23,29 +22,23 @@ return {
s("frontmatter", {
t("---"),
t({ "", "Markdown note", "" }),
t({ "", "title: \"" }), i(1), t("\""),
t({ "", "title: \"" }), i(8), t("\""),
t({ "", "date: \"" }), f(get_date, {}), t("\""),
t({ "", "author: \"" }), f(get_name, {}), t("\""),
t({ "", "keywords: ["}), i(2), t("]"),
t({ "", "tags: [["}), i(3), t("]]"),
t({ "", "keywords: ["}), i(6), t("]"),
t({ "", "tags: [["}), i(7), t("]]"),
t({ "", "id: " }), f(timestamp, {}),
t({ "", "---", "", "# " }),
rep(1), -- Reuses the first insert node
t({ "", ""}),
t({ "", ""}),
i(4) -- Final cursor position
}),
-- Creates a mood report template
s("wellbeingreport", {
t("---"),
t({ "", "Well-being report", "" }),
t({ "", "date: " }), f(get_date, {}),
t({ "", "" }),
t({ "", "sleep: " }), i(1), t("/5"),
t({ "", "emotions: [" }), i(2), t("]"),
t({ "", "comfort: " }), i(3), t("/5"),
t({ "", "complaints: ["}), i(4), t("]"),
t({ "", "mood: " }), i(5), t("/10"),
t({ "", "---" }),
t({ "", "---", "", "# " }),
rep(8), -- Reuses the first insert node
t({ "", ""}),
t({ "", ""}),
i(9) -- Final cursor position
}),
}