简体   繁体   English

如何在 VSCode 的 markdown 预览中启用复选框

[英]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.我正在尝试在 vscode markdown 预览中启用 markdown 复选框,但没有任何运气。 I've tried every combination of the following extensions with no luck:我已经尝试了以下扩展的所有组合,但没有成功:

  • Markdown Preview Enhanced Markdown 预览增强
  • Markdown All in One Markdown 多合一
  • Markdown Preview Github Styling Markdown 预览 Github 造型
  • Markdown Checkbox Markdown 复选框
  • Markdown Checkboxes Markdown 复选框

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.我遇到了同样的问题,看起来 VSCode markdown支持复选框,您需要安装扩展。

As of January, 2022 this is working for me in a markdown preview:截至 2022 年 1 月,这在 markdown 预览版中对我有用:

<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):注意这适用于已发布的 vscode 扩展 markdown 文件(在市场中):

市场复选框降价演示

But I am still investigating getting it to work in github - any ideas?但我仍在调查让它在 github 中工作 - 有什么想法吗? input elements do not appear to be in the prohibited list so it "should" work somehow. input元素似乎不在禁止列表中,因此它“应该”以某种方式工作。

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.但是请参阅https://github.com/gjtorikian/html-pipeline/blob/main/lib/html/pipeline/sanitization_filter.rb input元素不在 sanitizer 文件的允许列表中。

Here is the combination I use to replicate Github's styling for my READMEs这是我用来为我的 README 复制 Github 样式的组合

Make sure you reload VSCode after installing!确保安装后重新加载 VSCode!

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".我刚刚注意到,要让 Matt Bierner 的扩展“Markdown Checkbox”在预览中的复选框中正常工作,您必须禁用或卸载“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 All in One 似乎在渲染复选框时优先于第一个可以实际检查它们的扩展

Could be great to have some kind of fork in between both extensions.在两个扩展之间有某种分叉可能会很棒。

Checkboxes work in VSCode using Markdown All In One.复选框在 VSCode 中使用 Markdown All In One。 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

在此处输入图像描述

Foudn this here: https://docs.gitlab.com/ee/user/markdown.html#diagrams-and-flowcharts在这里找到: 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:您可以在列表项的 VSCode 文本框中(我也确定.md 文件)中执行 markdown 复选框:

  • [ ] Bug 1 Totally Inconceivable! [ ]错误 1完全不可思议!
  • [X] Bug 2 You keep using that word. [X] Bug 2你一直用那个词。 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.要“设置”复选框,请将方括号中的空格替换为 X。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM