It helps you to copy code with markdown fences and filename.
Execute command copyCodeAsMarkdown: Copy selection code as Markdown
.
Your clipboard then get sth like:
*config.yaml*
```yaml
taxonomies:
category: categories
tag: tags
series: series
author: authors
build:
useResourceCacheWhen: always
```
Execute command copyCodeAsMarkdown: copyCodeAsMarkdown: Switch using template
.
Here are some of the builtin templates:
{
"default": "*{filename}* {lineNumber}:\n```{lang}\n{text}\n```",
"lineRange": "*{filename}* {lineNumber} - {lineNumberEnd}:\n```{lang}\n{text}\n```",
"onlyCode": "```{lang}\n{text}\n```",
"onlyPosition": "{filename}:{lineNumber}:{colNumber}"
}
This extension has no default shortcut. You can set it by yourself.
Edit your keybinding setting via UI,
or edit config file for example c:\Users<USERNAME>\AppData\Roaming\Code\User\keybindings.json
{
"key": "ctrl+shift+c",
"command": "copy-code-as-markdown.CopySelectionAsMarkdown",
"when": "editorTextFocus"
},
Setting node is copyCodeAsMarkdown.template
. Available vars:
{filename}
{lineNumber}
{lineNumberEnd}
{colNumber}
{colNumberEnd}
{lang}
{text}
Example:
{
"copyCodeAsMarkdown.template": "```{lang}\n{text}\n```"
}