From fae986bce0cb9fb6f4fe1cfd24dc1971d4edd54c Mon Sep 17 00:00:00 2001 From: windingwind <33902321+windingwind@users.noreply.github.com> Date: Thu, 12 Sep 2024 08:17:26 +0000 Subject: [PATCH] add: markdown snippets in template editor --- addon/locale/en-US/templateEditor.ftl | 22 ++++++++++ addon/locale/it-IT/templateEditor.ftl | 22 ++++++++++ addon/locale/ru-RU/templateEditor.ftl | 22 ++++++++++ addon/locale/tr-TR/templateEditor.ftl | 22 ++++++++++ addon/locale/zh-CN/templateEditor.ftl | 22 ++++++++++ src/modules/template/editorWindow.ts | 61 +++++++++++++++++++++++++++ 6 files changed, 171 insertions(+) diff --git a/addon/locale/en-US/templateEditor.ftl b/addon/locale/en-US/templateEditor.ftl index 2c185e6..eca25cb 100644 --- a/addon/locale/en-US/templateEditor.ftl +++ b/addon/locale/en-US/templateEditor.ftl @@ -53,6 +53,28 @@ snippet-inlineScript = inline script .title = Add an inline JS script, the result of which will be embedded in the note snippet-multiLineScript = multi-line script .title = Add a multi-line async JS script, the return value of which will be embedded in the note +snippet-markdownHeading1 = heading 1 + .title = Markdown heading 1, type `#` at the beginning of the line followed by your heading. Should be used in markdown mode +snippet-markdownHeading2 = heading 2 + .title = Markdown heading 2, type `##` at the beginning of the line followed by your heading. Should be used in markdown mode +snippet-markdownHeading3 = heading 3 + .title = Markdown heading 3, type `###` at the beginning of the line followed by your heading. Should be used in markdown mode +snippet-markdownBullet = bullet list + .title = Markdown bullet list, type `-` at the beginning of the line followed by your list item. Should be used in markdown mode +snippet-markdownNumber = number list + .title = Markdown number list, type `1.` at the beginning of the line followed by your list item. Should be used in markdown mode +snippet-markdownBold = bold text + .title = Markdown bold text, type `**` at the beginning and end of your text. Should be used in markdown mode +snippet-markdownItalic = italic text + .title = Markdown italic text, type `_` at the beginning and end of your text. Should be used in markdown mode +snippet-markdownLink = link + .title = Markdown link, type `[` at the beginning and `](url)` at the end of your text. Should be used in markdown mode +snippet-markdownMonospace = monospace text + .title = Markdown monospace text, type ` at the beginning and end of your text. Should be used in markdown mode +snippet-markdownQuote = quote + .title = Markdown quote, type `>` at the beginning of the line followed by your quote. Should be used in markdown mode +snippet-markdownTable = table + .title = Markdown table, type `|` to separate columns and rows. Should be used in markdown mode snippet-dryRunFlag = dry run flag .title = Check if the template is running in dry run mode, e.g. for preview. In dry run mode, the script should not have side effects. snippet-itemBeforeLoop = before loop diff --git a/addon/locale/it-IT/templateEditor.ftl b/addon/locale/it-IT/templateEditor.ftl index 2a1ef46..2355e0d 100644 --- a/addon/locale/it-IT/templateEditor.ftl +++ b/addon/locale/it-IT/templateEditor.ftl @@ -53,6 +53,28 @@ snippet-inlineScript = inline script .title = Add an inline JS script, the result of which will be embedded in the note snippet-multiLineScript = multi-line script .title = Add a multi-line async JS script, the return value of which will be embedded in the note +snippet-markdownHeading1 = heading 1 + .title = Markdown heading 1, type `#` at the beginning of the line followed by your heading. Should be used in markdown mode +snippet-markdownHeading2 = heading 2 + .title = Markdown heading 2, type `##` at the beginning of the line followed by your heading. Should be used in markdown mode +snippet-markdownHeading3 = heading 3 + .title = Markdown heading 3, type `###` at the beginning of the line followed by your heading. Should be used in markdown mode +snippet-markdownBullet = bullet list + .title = Markdown bullet list, type `-` at the beginning of the line followed by your list item. Should be used in markdown mode +snippet-markdownNumber = number list + .title = Markdown number list, type `1.` at the beginning of the line followed by your list item. Should be used in markdown mode +snippet-markdownBold = bold text + .title = Markdown bold text, type `**` at the beginning and end of your text. Should be used in markdown mode +snippet-markdownItalic = italic text + .title = Markdown italic text, type `_` at the beginning and end of your text. Should be used in markdown mode +snippet-markdownLink = link + .title = Markdown link, type `[` at the beginning and `](url)` at the end of your text. Should be used in markdown mode +snippet-markdownMonospace = monospace text + .title = Markdown monospace text, type ` at the beginning and end of your text. Should be used in markdown mode +snippet-markdownQuote = quote + .title = Markdown quote, type `>` at the beginning of the line followed by your quote. Should be used in markdown mode +snippet-markdownTable = table + .title = Markdown table, type `|` to separate columns and rows. Should be used in markdown mode snippet-dryRunFlag = dry run flag .title = Check if the template is running in dry run mode, e.g. for preview. In dry run mode, the script should not have side effects. snippet-itemBeforeLoop = before loop diff --git a/addon/locale/ru-RU/templateEditor.ftl b/addon/locale/ru-RU/templateEditor.ftl index 48b7c40..68aa78c 100644 --- a/addon/locale/ru-RU/templateEditor.ftl +++ b/addon/locale/ru-RU/templateEditor.ftl @@ -53,6 +53,28 @@ snippet-inlineScript = inline script .title = Add an inline JS script, the result of which will be embedded in the note snippet-multiLineScript = multi-line script .title = Add a multi-line async JS script, the return value of which will be embedded in the note +snippet-markdownHeading1 = heading 1 + .title = Markdown heading 1, type `#` at the beginning of the line followed by your heading. Should be used in markdown mode +snippet-markdownHeading2 = heading 2 + .title = Markdown heading 2, type `##` at the beginning of the line followed by your heading. Should be used in markdown mode +snippet-markdownHeading3 = heading 3 + .title = Markdown heading 3, type `###` at the beginning of the line followed by your heading. Should be used in markdown mode +snippet-markdownBullet = bullet list + .title = Markdown bullet list, type `-` at the beginning of the line followed by your list item. Should be used in markdown mode +snippet-markdownNumber = number list + .title = Markdown number list, type `1.` at the beginning of the line followed by your list item. Should be used in markdown mode +snippet-markdownBold = bold text + .title = Markdown bold text, type `**` at the beginning and end of your text. Should be used in markdown mode +snippet-markdownItalic = italic text + .title = Markdown italic text, type `_` at the beginning and end of your text. Should be used in markdown mode +snippet-markdownLink = link + .title = Markdown link, type `[` at the beginning and `](url)` at the end of your text. Should be used in markdown mode +snippet-markdownMonospace = monospace text + .title = Markdown monospace text, type ` at the beginning and end of your text. Should be used in markdown mode +snippet-markdownQuote = quote + .title = Markdown quote, type `>` at the beginning of the line followed by your quote. Should be used in markdown mode +snippet-markdownTable = table + .title = Markdown table, type `|` to separate columns and rows. Should be used in markdown mode snippet-dryRunFlag = dry run flag .title = Check if the template is running in dry run mode, e.g. for preview. In dry run mode, the script should not have side effects. snippet-itemBeforeLoop = before loop diff --git a/addon/locale/tr-TR/templateEditor.ftl b/addon/locale/tr-TR/templateEditor.ftl index 36b8923..b364ee4 100644 --- a/addon/locale/tr-TR/templateEditor.ftl +++ b/addon/locale/tr-TR/templateEditor.ftl @@ -53,6 +53,28 @@ snippet-inlineScript = inline script .title = Add an inline JS script, the result of which will be embedded in the note snippet-multiLineScript = multi-line script .title = Add a multi-line async JS script, the return value of which will be embedded in the note +snippet-markdownHeading1 = heading 1 + .title = Markdown heading 1, type `#` at the beginning of the line followed by your heading. Should be used in markdown mode +snippet-markdownHeading2 = heading 2 + .title = Markdown heading 2, type `##` at the beginning of the line followed by your heading. Should be used in markdown mode +snippet-markdownHeading3 = heading 3 + .title = Markdown heading 3, type `###` at the beginning of the line followed by your heading. Should be used in markdown mode +snippet-markdownBullet = bullet list + .title = Markdown bullet list, type `-` at the beginning of the line followed by your list item. Should be used in markdown mode +snippet-markdownNumber = number list + .title = Markdown number list, type `1.` at the beginning of the line followed by your list item. Should be used in markdown mode +snippet-markdownBold = bold text + .title = Markdown bold text, type `**` at the beginning and end of your text. Should be used in markdown mode +snippet-markdownItalic = italic text + .title = Markdown italic text, type `_` at the beginning and end of your text. Should be used in markdown mode +snippet-markdownLink = link + .title = Markdown link, type `[` at the beginning and `](url)` at the end of your text. Should be used in markdown mode +snippet-markdownMonospace = monospace text + .title = Markdown monospace text, type ` at the beginning and end of your text. Should be used in markdown mode +snippet-markdownQuote = quote + .title = Markdown quote, type `>` at the beginning of the line followed by your quote. Should be used in markdown mode +snippet-markdownTable = table + .title = Markdown table, type `|` to separate columns and rows. Should be used in markdown mode snippet-dryRunFlag = dry run flag .title = Check if the template is running in dry run mode, e.g. for preview. In dry run mode, the script should not have side effects. snippet-itemBeforeLoop = before loop diff --git a/addon/locale/zh-CN/templateEditor.ftl b/addon/locale/zh-CN/templateEditor.ftl index c7f7324..cde9c52 100644 --- a/addon/locale/zh-CN/templateEditor.ftl +++ b/addon/locale/zh-CN/templateEditor.ftl @@ -52,6 +52,28 @@ snippet-inlineScript = 内联脚本 .title = 添加一个内联 JS 脚本,其结果将嵌入到笔记中 snippet-multiLineScript = 多行脚本 .title = 添加一个多行异步 JS 脚本,其返回值将嵌入到笔记中 +snippet-markdownHeading1 = 一级标题 + .title = Markdown 一级标题,在行首输入 `#` 后跟你的标题。应在 Markdown 模式下使用 +snippet-markdownHeading2 = 二级标题 + .title = Markdown 二级标题,在行首输入 `##` 后跟你的标题。应在 Markdown 模式下使用 +snippet-markdownHeading3 = 三级标题 + .title = Markdown 三级标题,在行首输入 `###` 后跟你的标题。应在 Markdown 模式下使用 +snippet-markdownBullet = 无序列表 + .title = Markdown 无序列表,在行首输入 `-` 后跟你的列表项。应在 Markdown 模式下使用 +snippet-markdownNumber = 有序列表 + .title = Markdown 有序列表,在行首输入 `1.` 后跟你的列表项。应在 Markdown 模式下使用 +snippet-markdownBold = 加粗文本 + .title = Markdown 加粗文本,在文本的开头和结尾输入 `**`。应在 Markdown 模式下使用 +snippet-markdownItalic = 斜体文本 + .title = Markdown 斜体文本,在文本的开头和结尾输入 `_`。应在 Markdown 模式下使用 +snippet-markdownLink = 链接 + .title = Markdown 链接,在文本的开头输入 `[`,在结尾输入 `](url)`。应在 Markdown 模式下使用 +snippet-markdownMonospace = 单行 + .title = Markdown 单行,在文本的开头和结尾输入 `。应在 Markdown 模式下使用 +snippet-markdownQuote = 引用 + .title = Markdown 引用,在行首输入 `>` 后跟你的引用内容。应在 Markdown 模式下使用 +snippet-markdownTable = 表格 + .title = Markdown 表格,使用 `|` 分隔列和行。应在 Markdown 模式下使用 snippet-dryRunFlag = dry run标志 .title = 检查模板是否在dry run模式下运行,例如用于预览。在dry run模式下,脚本不应有副作用。 snippet-itemBeforeLoop = 循环前 diff --git a/src/modules/template/editorWindow.ts b/src/modules/template/editorWindow.ts index 109da09..67da273 100644 --- a/src/modules/template/editorWindow.ts +++ b/src/modules/template/editorWindow.ts @@ -609,6 +609,67 @@ const snippetsStore = { code: "\n${{\n // write your script here\n}}$\n", type: "syntax", }, + { + name: "markdownHeading1", + code: "\n# type your heading here", + type: "syntax", + }, + { + name: "markdownHeading2", + code: "\n## type your heading here", + type: "syntax", + }, + { + name: "markdownHeading3", + code: "\n### type your heading here", + type: "syntax", + }, + { + name: "markdownBullet", + code: "\n\n- type your bullet list here", + type: "syntax", + }, + { + name: "markdownNumber", + code: "\n\n1. type your number list here", + type: "syntax", + }, + { + name: "markdownBold", + code: "**type your bold text here**", + type: "syntax", + }, + { + name: "markdownItalic", + code: "_type your italic text here_", + type: "syntax", + }, + { + name: "markdownLink", + code: "[type your link text here](type your link url here)", + type: "syntax", + }, + { + name: "markdownMonospace", + code: "\n\n`type your text here`", + type: "syntax", + }, + { + name: "markdownQuote", + code: "\n\n> type your quote here", + type: "syntax", + }, + { + name: "markdownTable", + code: ` + +| Header 1 | Header 2 | +|----------|----------| +| Cell 1 | Cell 2 | + +`, + type: "syntax", + }, { name: "dryRunFlag", code: "_env.dryRun",