How to enable checkboxes in markdown preview for VSCode - visual-studio-code

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.

Related

Markdown: todo list not Showing in Jupyter Notebook Cell in VSCode

On the github.docs I saw that it is possible to create markdown todo-lists as follows
- [ ] my first task
- [ ] my second task
When I am trying this in VSCode in a .ipynb Markdown cell, it doesn't render the todo-list. So it basically does not show rendered square but rather shows it just as I typed it in. So it does show it as this
but not as this
I am using the Jupyter extension for VSCode.
I think it has to do something with this extension. However, rendering a table for example works. Also including pictures and basically any other Markdown command I tried. Only the todo-list does not.
Can anyone help with this?
According to this GitHub issue, VSCode does not support markdown todo-lists out of the box. However, you can use the Markdown Checkbox extension, which renders todo-lists in .ipynb Markdown cells.
For reference, this is what the result looks like.

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.

How do I recognize the extension that has taken over markdown editing

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"
}]

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
}
}

Visual Studio Code disable auto closing tags

I'm trying to prevent auto closing tags, but the following setting doesn't seem to work:
{
"html.autoClosingTags": false,
}
What else must be done to make auto-closing tags go away?
Just in case anyone looking at this is finding that HTML tags are still being automatically closed inside JSX files. The setting you need is:
{
"javascript.autoClosingTags": false,
"typescript.autoClosingTags": false
}
Open Visual Studio Code, go to Preferences -> Settings
Under the User Settings tab, click Text Editor, and search for the setting Auto Closing Tags. Uncheck HTML: Auto Closing Tags
This search results also allow you to disable auto closing for JavaScript and TypeScript, if desired.
Based on Visual Studio Code 1.64.2 for macOS.
For me, the solution was in an extension. I had the Auto Close Tag extension installed (who knows when I though that was a good idea) that was overriding the built in autoclose. Disabling the extension fixed it.
Take a look through your enabled extensions and see if there's any that might be adding this behavior.
The following worked for me:
Go to File > Preference > Setting (Ctrl + ,)
Extension > HTML
And remove tick from the "Auto Closing Tags".
Hope this helps. Cheers :)
Disabling autoclosing for only TypeScript generics
To eliminate autoclosing on TS <generic> tags, but leave it on otherwise, install the Auto Close Tag VSCode extension and add the following lines to your JSON user settings:
{
"auto-close-tag.disableOnLanguage": [
"typescript",
"typescriptreact"
]
}
Further Reading: TypeScript Generics: Adds closing "Tag" to type specifier #17
You might need to delete the comma after "false" - Visual Studio Code doesn't seem to like commas after the last statement in preferences.
Just ran into this problem and I went to preferences -> settings -> extensions -> HTML -> disable autoclosing of HTML tags. Hope this helps!
I just looked this one up myself and noticed there was no verified answer. Those saying you have to go to the HTML portion are absolutely correct, if you don't uncheck that checkbox under HTML: Auto Closing Tags then you will keep getting the closing tags.