I am working on some documents in words and evernote, need convert the contents to markdown and save to obsidian.
What I usually do is manually add code block :
```python
import xxx
some_content = 'balabala'
more = ....
```
As you know ctrl #
is add comment to every line.
So I wonder if there is any way to
use cursor make selection of text
hit a shortcut to wrap that text with
```language selected text ```
I have search in google but nothing useful found.
CodePudding user response:
Does this key binding help
{
"key": "ctrl i 1", // or any other combo
"command": "editor.action.insertSnippet",
"when": "editorTextFocus",
"args": {
"snippet": "```python\n$TM_SELECTED_TEXT\n```\n$0"
}
}
You can add a language selection:
{
"key": "ctrl i 1",
"command": "editor.action.insertSnippet",
"when": "editorTextFocus",
"args": {
"snippet": "```${1|python,javascript|}\n$TM_SELECTED_TEXT\n```\n$0"
}
}