From 684e75e2a75606cc231efc70f61f99a5c54c70c3 Mon Sep 17 00:00:00 2001 From: Edward Angert Date: Thu, 21 Nov 2024 17:09:56 -0500 Subject: [PATCH] docs: create a markdown code snippet file to make it easier for contributors (#15611) adds snippets to make some of the docs markdown components a little easier to use - wraps selected text where it seems appropriate - limits code block languages (these are suggestions, you can choose from the list or enter anything) tabs example: ![tabs gif](https://github.com/user-attachments/assets/226b942e-4b34-4d3b-8561-84c5a17e2805) --------- Co-authored-by: EdwardAngert <17991901+EdwardAngert@users.noreply.github.com> --- .gitignore | 2 ++ .prettierignore | 2 ++ .vscode/markdown.code-snippets | 38 ++++++++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+) create mode 100644 .vscode/markdown.code-snippets diff --git a/.gitignore b/.gitignore index 0c07d1eea5..16607eacaa 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,8 @@ yarn-error.log # Allow VSCode recommendations and default settings in project root. !/.vscode/extensions.json !/.vscode/settings.json +# Allow code snippets +!/.vscode/*.code-snippets # Front-end ignore patterns. .next/ diff --git a/.prettierignore b/.prettierignore index 0391d7ede4..8b84ba3315 100644 --- a/.prettierignore +++ b/.prettierignore @@ -20,6 +20,8 @@ yarn-error.log # Allow VSCode recommendations and default settings in project root. !/.vscode/extensions.json !/.vscode/settings.json +# Allow code snippets +!/.vscode/*.code-snippets # Front-end ignore patterns. .next/ diff --git a/.vscode/markdown.code-snippets b/.vscode/markdown.code-snippets new file mode 100644 index 0000000000..0d1fcf3402 --- /dev/null +++ b/.vscode/markdown.code-snippets @@ -0,0 +1,38 @@ +{ + // For info about snippets, visit https://code.visualstudio.com/docs/editor/userdefinedsnippets + + "admonition": { + "prefix": "#callout", + "body": [ + "
\n", + "${TM_SELECTED_TEXT:${2:add info here}}\n", + "
\n" + ], + "description": "callout admonition caution info note tip warning" + }, + "fenced code block": { + "prefix": "#codeblock", + "body": ["```${1|apache,bash,console,diff,Dockerfile,env,go,hcl,ini,json,lisp,md,powershell,shell,sql,text,tf,tsx,yaml|}", "${TM_SELECTED_TEXT}$0", "```"], + "description": "fenced code block" + }, + "image": { + "prefix": "#image", + "body": "![${TM_SELECTED_TEXT:${1:alt}}](${2:url})$0", + "description": "image" + }, + "tabs": { + "prefix": "#tabs", + "body": [ + "
\n", + "${1:optional description}\n", + "## ${2:tab title}\n", + "${TM_SELECTED_TEXT:${3:first tab content}}\n", + "## ${4:tab title}\n", + "${5:second tab content}\n", + "## ${6:tab title}\n", + "${7:third tab content}\n", + "
\n" + ], + "description": "tabs" + } +}