How do I recognize the extension that has taken over markdown editing - visual-studio-code

I suddenly find that my markdown files are being opened by a wysiwyg editor with chinese menus. No language is detected and searching through my extensions gave no hint. How do I figure out which extension is active?

In general, there is a command called "Developer: Show Running Extensions" that you can activate from the command palette.
In this case, I see a weird spelling in that screenshot: "Vditor".
Searching for that word finds a few pages, including one whose title is "vditor VS vscode-markdown-editor". From that page, I found Vanessa219/vditor.
That project claims to be
An In-browser Markdown editor, support WYSIWYG (Rich Text), Instant Rendering (Typora-like) and Split View modes
but not a Visual Studio Code plugin.
However, the extension vscode all markdown says it is "powered by" Vditor. I suspect you'll find that's the plugin to disable.
There is also something called vscode-office. It uses Vditor for Markdown out of the box, but this can be disabled:
It change markdown editor as vditor, it's WYSIWYG editor for markdown...
if you want using vscode editor, insert below json to vscode config.
"workbench.editorAssociations": [{
"viewType": "default",
"filenamePattern": "*.md"
}]

Related

Markdown headings not appearing in outline box in VS Code

While editing a markdown document in VS Code, the outline box does not show me the outline of the markdown document; it's completely blank/empty. I've disabled all extensions with no change in behavior (and I only had one markdown-related extension anyway, markdownlint). I don't know that this has ever worked, but it certainly has not for the last several months.
OS: Mac OS 12.3
VS Code: 1.65.2
Out of the box, Markdown headings should show up in the outline view as text nodes:
If the outline view is configured not to show strings, Markdown headers won't appear.
Take a look at the Outline: Show Strings setting in your preferences and make sure it's enabled.
This setting is called outline.showStrings. If you wish to enable it only for Markdown files, you should be able to disable the feature globally and then add something like this to your settings.json:
"[markdown]": {
"outline.showStrings": true
},
It's probably easiest to start by running Preferences: Configure Language Specific Settings... in the command palette and then selecting Markdown.

Is there a way to open any file as text in VS Code?

VS Code is currently my favourite text editor, except for Jupyter notebooks, which are opened as interactive python environments (let's call this 'rendered').
By itself it is nice that this is possible, but not I can live with opening them in a browser if VS Code would not render them.
There used to be a setting to avoid this behaviour ("jupyter.useNotebookEditor": false) but currently my installation does not recognise this setting anymore.
Since there are more file types that can be opened as text/source, or rendered form (e.g. html, md, svg, uncompressed pdf, etc.) and both forms can be usefull, I would be very excited to learn how to switch between rendered and source, preferably without switching global settings.
Is there a way to do this? I would hope for:
a mechanism that does not depend on (or can be overwritten by) the current jupyter extension
a mechanism that works for any file type (nice-to-have)
Are you just looking for a way to view/edit the raw json?
You can right click the file in the Explorer -> open with... -> text editor.
Or use "Reopen editor with text editor" from the command Palette (ctrl+shift+p)

How to enable checkboxes in markdown preview for VSCode

I'm trying to enable markdown checkboxes in vscode markdown preview but am not having any luck. I've tried every combination of the following extensions with no luck:
Markdown Preview Enhanced
Markdown All in One
Markdown Preview Github Styling
Markdown Checkbox
Markdown Checkboxes
Does anyone have a configuration of extensions where this is working for you?
I was facing the same issue, and it looks like VSCode markdown does not support checkboxes and you need to install an extension.
Checkboxes work in VSCode using the Markdown All In One extension.
The trick is that the checkboxes also have to be part of a list.
This doesn't work:
[ ] Unchecked
[ ] Checked
This works:
- [ ] Unchecked
- [x] Checked
As of January, 2022 this is working for me in a markdown preview:
<input type="checkbox" checked> some checked text
<input type="checkbox"> some unchecked text
NOTE This works in a published vscode extension markdown file (in the Marketplace):
But I am still investigating getting it to work in github - any ideas? input elements do not appear to be in the prohibited list so it "should" work somehow.
But see https://github.com/gjtorikian/html-pipeline/blob/main/lib/html/pipeline/sanitization_filter.rb input elements are not in the allowed list in the sanitizer file.
Here is the combination I use to replicate Github's styling for my READMEs
Make sure you reload VSCode after installing!
Name: GitHub Markdown Preview
Id: bierner.github-markdown-preview
Description: Changes VS Code's built-in markdown preview to match GitHub
Version: 0.2.0
Publisher: Matt Bierner
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=bierner.github-markdown-preview
I just noticed that for the extension "Markdown Checkbox" by Matt Bierner to work properly in checking boxes in preview, you have to either disable or uninstall "Markdown All in One". All in One seems to be prioritized in the rendering of the checkboxes over the first extension in which they can actually be checked
Could be great to have some kind of fork in between both extensions.
I lost all day and no found the solution. I solved with a simple manera in vb.net ...
two instruction and work...
nCheckBox.Checked = False
nCheckBox.Checked = True
Foudn this here: https://docs.gitlab.com/ee/user/markdown.html#diagrams-and-flowcharts
You can do markdown checkboxes like this in VSCode text boxes (and I'm sure .md files too) in list items:
[ ] Bug 1 Totally Inconceivable!
[X] Bug 2 You keep using that word. I do not think it means what you think it means.
to "set" the check box, replace the space in the square brackets with a X.

Disable onsave formating for .ejs files in visual studio code

I'm working with ejs files, but in order to reuse some code, I'm using the includes feature. Given that some opening/closing html tags are placed in other files, after I save my changes, something (I don't know if prettier extension or VS code editor) is including the closing tags into my code, causing several problems when I running it.
An other solution is to use a .prettierignore file and put in :
*.ejs
in your settings.json you should add these settings.
just instead of "[css]" type what you want. (the format of the file)
and just please ignore line 2 :) that's not related to this answer.
Edit
as #aegatlin said use this: "[html]".(if "[ejs]" didn't work for you)
I don't use EJS myself, but after playing around with it in VSCode, I noticed that my .ejs files were being treated as HTML files. You can see how your VSCode is interpreting the file by looking in the bottom right corner of the editor. You could search for EJS extensions as well.
You likely have the "Editor: format on save" option enabled. To disable that setting, go to Preferences, and in the search bar type "format on save". Find the setting. Uncheck the box. That should fix the problem.
If, as you mentioned, your closing HTML tags are in other files, then you have invalid HTML and the formatter (both Prettier's and the default one) will autocomplete the closing tag. (I would wager EJS also wouldn't like the lack of closing tags, but since I don't use it I'm not so sure, maybe it's fine.)
Zulhilmi Zainudin has the solution
https://medium.com/#zulhhandyplast/how-to-disable-vs-code-formatonsave-for-specific-file-extensions-c60e8f254243
In vscode setting file, associate ejs extentions files to a « language ». Then you can specify different rules for this that language :
.vscode/settings.json file content :
{
"files.associations": {
"*.ejs": "ejs" // this create the language « ejs » which refers to any .ejs file
},
"[ejs]": { // custom settings for the language « ejs »
"editor.formatOnSave": false
}
}

Is it possible to apply syntax highlighting of one filetype to another in Visual Studio Code, like in Notepad++?

Somebody who used Notepad++ clearly knows about applying custom syntax highlighting to any text, by selecting an option from the "Language" menu, as shown the screenshot below;
This way, one can highlight the text, as he wish. I would like to know, is there any similar mechanism in Visual Studio Code editor, so that I can manually highlight the text even if its not done automatically.
Thanks.
You can change the Language used for a particular instance by clicking on the Language ID field in the Status bar and select the new language from the list.
This executes the command workbench.action.editor.changeLanguageMode or Change Language Mode from the Command palette.
To do a permanent Language ID selection based on the file extension define a setting
"files.associations": {
"*.myext": "html",
"*.myfoo": "css"
}