Skip to content

Instantly share code, notes, and snippets.

@jthomasmock
Last active January 12, 2023 02:02
Embed
What would you like to do?
#### ---------------------------------------------
## Edit via: RStudio > Tools > Edit Code Snippets
# Released under a MIT license
snippet fragment
[${1:text}]{.${2:type}}
snippet aside
[${1:text}]{.aside}
snippet fence
:::{.${1:type}}
${2:body}
:::
snippet panel
::: {.panel-tabset}
${1:body}
:::
snippet column
:::: {.columns}
::: {.column width="50%"}
Left column
:::
::: {.column width="50%"}
Right column
:::
::::
# Code image at: ![](https://i.imgur.com/jhOo3mq.png)
@pat-s
Copy link

pat-s commented Aug 17, 2022

Here's the vscode equivalent.
To use it

  1. Command palette (cmd+shift+p): "configure user snippets"
  2. quarto.json
  3. Insert the template below
  4. Within an .qmd file, call "Insert snippet" from the command palette (cmd+shift+p) and select the respective snippet
{
  "column": {
    "prefix": "column",
    "body": [":::: {.columns}", "", "::: {.column width=\"40%\"}", "Left column", ":::", "", "::: {.column width=\"60%\"}", "Right column", ":::", "", "::::"],
    "description": "quarto columns"
  },
  "panel": {
    "prefix": "panel",
    "body": ["::: {.panel-tabset}", "${1:body}", ":::"],
    "description": "quarto panel"
  },
  "fence": {
    "prefix": "fence",
    "body": [":::{.${1:type}}", "${2:body}", ":::"],
    "description": "quarto fence"
  },
  "aside": {
    "prefix": "",
    "body": ["::: aside", "${1:body}", ":::"],
    "description": "quarto aside"
  },
  "fragment": {
    "prefix": "",
    "body": ["::: {.fragment .${1:type}}", "${2:body}", ":::"],
    "description": "quarto fragment"
  },
}

@remlapmot
Copy link

Very helpful. Perhaps change the filename to markdown.snippets because that's the filename RStudio saves these in, and GitHub automatically provides syntax highlighting for .snippets files.

@jthomasmock
Copy link
Author

Very helpful. Perhaps change the filename to markdown.snippets because that's the filename RStudio saves these in, and GitHub automatically provides syntax highlighting for .snippets files.

Excellent, done!!

@aborruso
Copy link

thank you very much

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment