From ff488ac372deac26dbf61b4c3b71a9a534d32ab7 Mon Sep 17 00:00:00 2001 From: Phu Ninh <18023194+phongphuhanam@users.noreply.github.com> Date: Mon, 8 Sep 2025 14:53:31 +0900 Subject: [PATCH 1/2] fix json format error --- snippets/quarto.json | 675 ++++++++++++++++++++++++++++--------------- 1 file changed, 447 insertions(+), 228 deletions(-) diff --git a/snippets/quarto.json b/snippets/quarto.json index 5a6452bc..150c6c1e 100644 --- a/snippets/quarto.json +++ b/snippets/quarto.json @@ -1,154 +1,170 @@ { - "Insert bold text": { - "prefix": "bold", - "body": "**${1:${TM_SELECTED_TEXT}}**$0", - "description": "Insert bold text" - }, - "Insert italic text": { - "prefix": "italic", - "body": "*${1:${TM_SELECTED_TEXT}}*$0", - "description": "Insert italic text" - }, - "Insert quoted text": { - "prefix": "quote", - "body": "> ${1:${TM_SELECTED_TEXT}}", - "description": "Insert quoted text" - }, - "Insert inline code": { - "prefix": "code", - "body": "`${1:${TM_SELECTED_TEXT}}`$0", - "description": "Insert inline code" - }, - "Insert shortcode": { - "prefix": "shortcode", - "body": "{{< $0 >}}", - "description": "Insert shortcode" - }, - "Insert fenced code block": { - "prefix": "fenced codeblock", - "body": [ - "```${1|python,c,c++,c#,ruby,go,java,php,htm,css,javascript,json,markdown,console,r|}", - "${TM_SELECTED_TEXT}$0", - "```" - ], - "description": "Insert fenced code block" - }, - "Insert executable code block": { - "prefix": "executable codeblock", - "body": [ - "```{${1|python,r,julia,ojs,sql,bash|}}", - "${TM_SELECTED_TEXT}$0", - "```" - ], - "description": "Insert executable code block" - }, - "Insert raw code block": { - "prefix": "raw codeblock", - "body": [ - "```{${1|html,latex,openxml,opendocument,asciidoc,docbook,markdown,dokuwiki,fb2,gfm,haddock,icml,ipynb,jats,jira,json,man,mediawiki,ms,muse,opml,org,plain,rst,rtf,tei,texinfo,textile,xwiki,zimwiki,native,r|}}", - "${TM_SELECTED_TEXT}$0", - "```" - ], - "description": "Insert raw code block" - }, - "Insert heading level 1": { - "prefix": "heading1", - "body": "# ${1:${TM_SELECTED_TEXT}}", - "description": "Insert heading level 1" - }, - "Insert heading level 2": { - "prefix": "heading2", - "body": "## ${1:${TM_SELECTED_TEXT}}", - "description": "Insert heading level 2" - }, - "Insert heading level 3": { - "prefix": "heading3", - "body": "### ${1:${TM_SELECTED_TEXT}}", - "description": "Insert heading level 3" - }, - "Insert heading level 4": { - "prefix": "heading4", - "body": "#### ${1:${TM_SELECTED_TEXT}}", - "description": "Insert heading level 4" - }, - "Insert heading level 5": { - "prefix": "heading5", - "body": "##### ${1:${TM_SELECTED_TEXT}}", - "description": "Insert heading level 5" - }, - "Insert heading level 6": { - "prefix": "heading6", - "body": "###### ${1:${TM_SELECTED_TEXT}}", - "description": "Insert heading level 6" - }, - "Insert unordered list": { - "prefix": "unordered list", - "body": ["- ${1:first}", "- ${2:second}", "- ${3:third}", "$0"], - "description": "Insert unordered list" - }, - "Insert ordered list": { - "prefix": "ordered list", - "body": ["1. ${1:first}", "2. ${2:second}", "3. ${3:third}", "$0"], - "description": "Insert ordered list" - }, - "Insert horizontal rule": { - "prefix": "horizontal rule", - "body": "----------\n", - "description": "Insert horizontal rule" - }, - "Insert link": { - "prefix": "link", - "body": "[${TM_SELECTED_TEXT:${1:text}}](https://${2:link})$0", - "description": "Insert link" - }, - "Insert image": { - "prefix": "image", - "body": "![${TM_SELECTED_TEXT:${1:alt}}](https://${2:link})$0", - "description": "Insert image" - }, - "Insert strikethrough": { - "prefix": "strikethrough", - "body": "~~${1:${TM_SELECTED_TEXT}}~~", - "description": "Insert strikethrough" - }, - "Insert div block": { - "prefix": "div", - "body": ["::: {.${1:class}}", "${TM_SELECTED_TEXT}$0", ":::"], - "description": "Insert div block" - }, - "Insert callout block": { - "prefix": "callout", - "body": [ - "::: {.${1|callout,callout-note,callout-tip,callout-important,callout-caution,callout-warning|}}", - "${TM_SELECTED_TEXT}$0", - ":::" - ], - "description": "Insert callout block" - }, - "Insert citation": { - "prefix": "cite", - "body": [ - "[@${1:city-key}]" - ], - "description": "Insert a citation" - }, - "Insert an inline footnote": { - "prefix": "footnote-inline", - "body": [ - "[^${1:note text}]" - ], - "description": "Insert an inline footnote" - }, - "Insert a footnote": { - "prefix": "footnote", - "body": [ - "[^${1:note identifier}]", - "[^$1]: ${2:note text}" - ], - "description": "Insert an inline footnote" - }, + "Insert bold text": { + "prefix": "bold", + "body": "**${1:${TM_SELECTED_TEXT}}**$0", + "description": "Insert bold text" + }, + "Insert italic text": { + "prefix": "italic", + "body": "*${1:${TM_SELECTED_TEXT}}*$0", + "description": "Insert italic text" + }, + "Insert quoted text": { + "prefix": "quote", + "body": "> ${1:${TM_SELECTED_TEXT}}", + "description": "Insert quoted text" + }, + "Insert inline code": { + "prefix": "code", + "body": "`${1:${TM_SELECTED_TEXT}}`$0", + "description": "Insert inline code" + }, + "Insert shortcode": { + "prefix": "shortcode", + "body": "{{< $0 >}}", + "description": "Insert shortcode" + }, + "Insert fenced code block": { + "prefix": "fenced codeblock", + "body": [ + "```${1|python,c,c++,c#,ruby,go,java,php,htm,css,javascript,json,markdown,console,r|}", + "${TM_SELECTED_TEXT}$0", + "```" + ], + "description": "Insert fenced code block" + }, + "Insert executable code block": { + "prefix": "executable codeblock", + "body": [ + "```{${1|python,r,julia,ojs,sql,bash|}}", + "${TM_SELECTED_TEXT}$0", + "```" + ], + "description": "Insert executable code block" + }, + "Insert raw code block": { + "prefix": "raw codeblock", + "body": [ + "```{${1|html,latex,openxml,opendocument,asciidoc,docbook,markdown,dokuwiki,fb2,gfm,haddock,icml,ipynb,jats,jira,json,man,mediawiki,ms,muse,opml,org,plain,rst,rtf,tei,texinfo,textile,xwiki,zimwiki,native,r|}}", + "${TM_SELECTED_TEXT}$0", + "```" + ], + "description": "Insert raw code block" + }, + "Insert heading level 1": { + "prefix": "heading1", + "body": "# ${1:${TM_SELECTED_TEXT}}", + "description": "Insert heading level 1" + }, + "Insert heading level 2": { + "prefix": "heading2", + "body": "## ${1:${TM_SELECTED_TEXT}}", + "description": "Insert heading level 2" + }, + "Insert heading level 3": { + "prefix": "heading3", + "body": "### ${1:${TM_SELECTED_TEXT}}", + "description": "Insert heading level 3" + }, + "Insert heading level 4": { + "prefix": "heading4", + "body": "#### ${1:${TM_SELECTED_TEXT}}", + "description": "Insert heading level 4" + }, + "Insert heading level 5": { + "prefix": "heading5", + "body": "##### ${1:${TM_SELECTED_TEXT}}", + "description": "Insert heading level 5" + }, + "Insert heading level 6": { + "prefix": "heading6", + "body": "###### ${1:${TM_SELECTED_TEXT}}", + "description": "Insert heading level 6" + }, + "Insert unordered list": { + "prefix": "unordered list", + "body": [ + "- ${1:first}", + "- ${2:second}", + "- ${3:third}", + "$0" + ], + "description": "Insert unordered list" + }, + "Insert ordered list": { + "prefix": "ordered list", + "body": [ + "1. ${1:first}", + "2. ${2:second}", + "3. ${3:third}", + "$0" + ], + "description": "Insert ordered list" + }, + "Insert horizontal rule": { + "prefix": "horizontal rule", + "body": "----------\n", + "description": "Insert horizontal rule" + }, + "Insert link": { + "prefix": "link", + "body": "[${TM_SELECTED_TEXT:${1:text}}](https://${2:link})$0", + "description": "Insert link" + }, + "Insert image": { + "prefix": "image", + "body": "![${TM_SELECTED_TEXT:${1:alt}}](https://${2:link})$0", + "description": "Insert image" + }, + "Insert strikethrough": { + "prefix": "strikethrough", + "body": "~~${1:${TM_SELECTED_TEXT}}~~", + "description": "Insert strikethrough" + }, + "Insert div block": { + "prefix": "div", + "body": [ + "::: {.${1:class}}", + "${TM_SELECTED_TEXT}$0", + ":::" + ], + "description": "Insert div block" + }, + "Insert callout block": { + "prefix": "callout", + "body": [ + "::: {.${1|callout,callout-note,callout-tip,callout-important,callout-caution,callout-warning|}}", + "${TM_SELECTED_TEXT}$0", + ":::" + ], + "description": "Insert callout block" + }, + "Insert citation": { + "prefix": "cite", + "body": [ + "[@${1:city-key}]" + ], + "description": "Insert a citation" + }, + "Insert an inline footnote": { + "prefix": "footnote-inline", + "body": [ + "[^${1:note text}]" + ], + "description": "Insert an inline footnote" + }, + "Insert a footnote": { + "prefix": "footnote", + "body": [ + "[^${1:note identifier}]", + "[^$1]: ${2:note text}" + ], + "description": "Insert an inline footnote" + }, "iframe": { - "prefix": ["iframe"], + "prefix": [ + "iframe" + ], "body": [ "::: {#fig-${1:cap}}", "", @@ -159,7 +175,9 @@ ] }, "tabset": { - "prefix": ["tabset"], + "prefix": [ + "tabset" + ], "body": [ ":::: {.panel-tabset}", "", @@ -175,7 +193,9 @@ ] }, "fig3": { - "prefix": ["fig3"], + "prefix": [ + "fig3" + ], "body": [ ":::: {#fig-${1:label} layout=\"[[1, 1], [1]]\"}", "", @@ -190,7 +210,9 @@ ] }, "fig2": { - "prefix": ["fig2"], + "prefix": [ + "fig2" + ], "body": [ ":::: {#fig-${1:label} layout=\"[1,1]\"}", "", @@ -203,23 +225,50 @@ ] }, "pycode": { - "prefix": ["pyc"], - "body": ["```{python} ", "$1", "```"] + "prefix": [ + "pyc" + ], + "body": [ + "```{python} ", + "$1", + "```" + ] }, "rcode": { - "prefix": ["rco"], - "body": ["```{r} ", "$1", "```"] + "prefix": [ + "rco" + ], + "body": [ + "```{r} ", + "$1", + "```" + ] }, "bashcode": { - "prefix": ["bco"], - "body": ["```{bash} ", "$1", "```"] + "prefix": [ + "bco" + ], + "body": [ + "```{bash} ", + "$1", + "```" + ] }, "code": { - "prefix": ["code"], - "body": ["```{$1} ", "$2", "```", "$0"] + "prefix": [ + "code" + ], + "body": [ + "```{$1} ", + "$2", + "```", + "$0" + ] }, "pyfig2": { - "prefix": ["pyfig2"], + "prefix": [ + "pyfig2" + ], "body": [ "```{python} ", "#| label: fig-$1", @@ -243,7 +292,9 @@ ] }, "pyfig1": { - "prefix": ["pyfig1"], + "prefix": [ + "pyfig1" + ], "body": [ "```{python}", "#| label: fig-$1", @@ -259,27 +310,51 @@ ] }, "div": { - "prefix": ["div"], - "body": ["::: {$1}", "$0", ":::"] + "prefix": [ + "div" + ], + "body": [ + "::: {$1}", + "$0", + ":::" + ] }, "figref": { - "prefix": ["figref"], - "body": ["@fig-$1"] + "prefix": [ + "figref" + ], + "body": [ + "@fig-$1" + ] }, "tblref": { - "prefix": ["tblref"], - "body": ["@tbl-$1"] + "prefix": [ + "tblref" + ], + "body": [ + "@tbl-$1" + ] }, "eqnref": { - "prefix": ["eqnref"], - "body": ["@eq-$1"] + "prefix": [ + "eqnref" + ], + "body": [ + "@eq-$1" + ] }, "secref": { - "prefix": ["secref"], - "body": ["@sec-$1"] + "prefix": [ + "secref" + ], + "body": [ + "@sec-$1" + ] }, "crossref": { - "prefix": ["crossref"], + "prefix": [ + "crossref" + ], "body": [ "crossref:", " fig-title: Figure", @@ -291,65 +366,115 @@ ] }, "fig": { - "prefix": ["fig"], - "body": ["![${1:cap1}](${2:figure}){#fig-$3}"] + "prefix": [ + "fig" + ], + "body": [ + "![${1:cap1}](${2:figure}){#fig-$3}" + ] }, "background image": { - "prefix": ["bgimg"], + "prefix": [ + "bgimg" + ], "body": [ "{data-background-image=\"$1\" background-position=center background-size=contain}" ] }, "background video": { - "prefix": ["bgvid"], + "prefix": [ + "bgvid" + ], "body": [ "{background-video=\"$1\" background-size=contain}" ] }, "background iframe": { - "prefix": ["bgiframe"], + "prefix": [ + "bgiframe" + ], "body": [ "{background-iframe=\"$1\" background-interactive=true}" ] }, "background color": { - "prefix": ["bgcol"], + "prefix": [ + "bgcol" + ], "body": [ "{background-color=\"$1\"}" ] }, "autoanimate": { - "prefix": ["anim"], + "prefix": [ + "anim" + ], "body": [ "{auto-animate=true}" ] }, "pl": { - "prefix": ["pl"], - "body": ["::: {.pull-left}", "$0", ":::"] + "prefix": [ + "pl" + ], + "body": [ + "::: {.pull-left}", + "$0", + ":::" + ] }, "pr": { - "prefix": ["pr"], - "body": ["::: {.pull-right}", "$0", ":::"] + "prefix": [ + "pr" + ], + "body": [ + "::: {.pull-right}", + "$0", + ":::" + ] }, "container": { - "prefix": ["con"], - "body": ["::: {.container}", "$1", ":::"] + "prefix": [ + "con" + ], + "body": [ + "::: {.container}", + "$1", + ":::" + ] }, "incremental": { - "prefix": ["inc"], - "body": ["::: {.incremental}", "-$1", ":::"] + "prefix": [ + "inc" + ], + "body": [ + "::: {.incremental}", + "-$1", + ":::" + ] }, "nonincremental": { - "prefix": ["noninc"], - "body": ["::: {.nonincremental}", "-$1", ":::"] + "prefix": [ + "noninc" + ], + "body": [ + "::: {.nonincremental}", + "-$1", + ":::" + ] }, "pause": { - "prefix": ["pause"], - "body": [". . ."] + "prefix": [ + "pause" + ], + "body": [ + ". . ." + ] }, "2col": { - "prefix": ["2col"], + "prefix": [ + "2col" + ], "body": [ "::: {.columns}", "::: {.column width=50%}", @@ -362,7 +487,9 @@ ] }, "cols": { - "prefix": ["cols"], + "prefix": [ + "cols" + ], "body": [ "::: {.columns}", "::: {.column width=\"$1\"}", @@ -375,68 +502,149 @@ ] }, "lay": { - "prefix": ["lay"], - "body": ["::: {layout=\"[$1]\"}", "$0", ":::"] + "prefix": [ + "lay" + ], + "body": [ + "::: {layout=\"[$1]\"}", + "$0", + ":::" + ] }, "layout-valign": { - "prefix": ["valign"], - "body": ["layout-valign=\"$0\""] + "prefix": [ + "valign" + ], + "body": [ + "layout-valign=\"$0\"" + ] }, "callout": { - "prefix": ["call"], - "body": ["::: {.callout-$1}", "$0", ":::"] + "prefix": [ + "call" + ], + "body": [ + "::: {.callout-$1}", + "$0", + ":::" + ] }, "col2": { - "prefix": ["col2"], - "body": ["::: {layout-ncol=2}", "$0", ":::"] + "prefix": [ + "col2" + ], + "body": [ + "::: {layout-ncol=2}", + "$0", + ":::" + ] }, "col3": { - "prefix": ["col3"], - "body": ["::: {layout-ncol=3}", "$0", ":::"] + "prefix": [ + "col3" + ], + "body": [ + "::: {layout-ncol=3}", + "$0", + ":::" + ] }, "absolute": { - "prefix": ["absolute"], - "body": ["{.absolute top=$1 left=$2 width=\"$3\" height=\"$4\"}"] + "prefix": [ + "absolute" + ], + "body": [ + "{.absolute top=$1 left=$2 width=\"$3\" height=\"$4\"}" + ] }, "width": { - "prefix": ["width"], - "body": ["{width=\"$3\"}"] + "prefix": [ + "width" + ], + "body": [ + "{width=\"$3\"}" + ] }, "hidden": { - "prefix": ["hidden"], - "body": ["{visibility=\"hidden\"}"] + "prefix": [ + "hidden" + ], + "body": [ + "{visibility=\"hidden\"}" + ] }, "uncount": { - "prefix": ["uncount"], - "body": ["{visibility=\"uncounted\"}"] + "prefix": [ + "uncount" + ], + "body": [ + "{visibility=\"uncounted\"}" + ] }, "align": { - "prefix": ["align"], - "body": ["{fig-align=\"center\"}"] + "prefix": [ + "align" + ], + "body": [ + "{fig-align=\"center\"}" + ] }, "fragment": { - "prefix": ["frag"], - "body": ["::: {.fragment}", "$0", ":::"] + "prefix": [ + "frag" + ], + "body": [ + "::: {.fragment}", + "$0", + ":::" + ] }, "notes": { - "prefix": ["notes"], - "body": ["::: {.notes}", "$0", ":::"] + "prefix": [ + "notes" + ], + "body": [ + "::: {.notes}", + "$0", + ":::" + ] }, "aside": { - "prefix": ["aside"], - "body": ["::: {.aside}", "$0", ":::"] + "prefix": [ + "aside" + ], + "body": [ + "::: {.aside}", + "$0", + ":::" + ] }, "alert": { - "prefix": ["alert"], - "body": ["[$0]{.alert}"] + "prefix": [ + "alert" + ], + "body": [ + "[$0]{.alert}" + ] }, "importmarkdown": { - "prefix": ["importmd"], - "body": ["from IPython.display import display, Markdown"] + "prefix": [ + "importmd" + ], + "body": [ + "from IPython.display import display, Markdown" + ] }, "pymarkdown": { - "prefix": ["pymd"], - "body": ["display(Markdown(\"\"\"", "{$1}", "\"\"\".format($1 = $1)))", ""] + "prefix": [ + "pymd" + ], + "body": [ + "display(Markdown(\"\"\"", + "{$1}", + "\"\"\".format($1 = $1)))", + "" + ] }, "bibliography": { "body": "bibliography: references.bib", @@ -444,12 +652,23 @@ "prefix": "bib" }, "diary header": { - "body": ["---", "title: \"$1\"", "date: \"$2\"", "categories: [$3]", "---"], + "body": [ + "---", + "title: \"$1\"", + "date: \"$2\"", + "categories: [$3]", + "---" + ], "description": "Add minimal yaml header", "prefix": "diary" }, "yaml header": { - "body": ["---", "title: $1", "format: $2", "---"], + "body": [ + "---", + "title: $1", + "format: $2", + "---" + ], "description": "Add minimal yaml header", "prefix": "yml" }, From 2cd4977a7fd63234d973226babc31036e3bbd61d Mon Sep 17 00:00:00 2001 From: Phu Ninh <18023194+phongphuhanam@users.noreply.github.com> Date: Mon, 8 Sep 2025 15:01:01 +0900 Subject: [PATCH 2/2] add Conditional Content https://quarto.org/docs/authoring/conditional.html --- snippets/quarto.json | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/snippets/quarto.json b/snippets/quarto.json index 150c6c1e..39a8c1cb 100644 --- a/snippets/quarto.json +++ b/snippets/quarto.json @@ -676,5 +676,25 @@ "body": "Fig. \\ref{fig-$1}", "description": "refer to a label for a wrap figure", "prefix": "@wrap" + }, + "Condition when format": { + "prefix": [ + "contwhenfmt" + ], + "body": [ + "::::::: {.content-visible when-format=\"$0\"}", + "$1", + ":::::::" + ] + }, + "Condition unless format": { + "prefix": [ + "contunlessfmt" + ], + "body": [ + "::::::: {.content-visible unless-format=\"$0\"}", + "$1", + ":::::::" + ] } }