-
Notifications
You must be signed in to change notification settings - Fork 29.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow disabling indented code blocks in the Markdown previewer. #234485
Comments
I have this problem when converting txt readmes into markdown, because indent the body text under headings. it's really, really annoying, because I have to use lists for nested headings. if there's an extension that does this I'll gladly use that, but I haven't found one |
@JaredRichardWilliam, glad you agree! I'd actually forgotten about that - indented content under headings in |
This sounds like a good fit for a markdown extension. These can add support for new syntax or modify existing syntax Our built-in markdown support targets standard markdown which will parse your examples differently than you want |
This comment has been minimized.
This comment has been minimized.
Yes we try to match common mark. Common mark will not parse your example well at all because everything until the blank line is considered inline html |
@mjbvz, I presume you meant to close as unplanned? |
This is now possible, per searKing/preview-vscode#96 (comment)! All that remains is to remediate the syntax highlighting:
|
Desire
As I've poorly aforedescribed at
reddit.com/r/vscode
(to 5 upvotes), I want a way to disable the conversion of a single tab or 2 spaces to a<pre><code>
. Instead, I want it these to merely be ignored (as they are in other markup languages, like HTML).Rationale
I author most of my markup in HTML, because it provides significantly more versatile and semantic markup capabilities. However, it has an (ultimately non-inherent, but in-practice) significant failure —
<code>
tags are not automatically syntax-highlighted by any parsers.Markdown, being a superset of HTML, improves this perfectly. As an example, when I render the undermentioned in VS Code with the PowerShell extension installed, I see beautiful colours:
However, that's really difficult to read. It gets exponentially more difficult if, for example, you have nested tables with code blocks in each. At that stage, I basically have to re-indent and then de-indent each time I modify the markup. It's a dreadful workflow.
Instead, it should be the undermentioned:
However, all beneath the first
<td>
shall render in a<pre><code>
.This is, of course, a basic example, where the aforedescribed potential complexity is less evident. However, I can provide incredibly complex examples if necessary.
Summarily, having this implemented would completely change how I write my Markdown documents. I would finally be able to write the HTML within them in a readable manner, and have syntax-highlighted code blocks, without needing to deal with the indentation havoc that is
<pre>
.Feasibility
Per 11ty/eleventy#2438 (comment), this should be possible in VS Code, since
markdown-it
appears to be the parser that VS Code uses, and it supports the ability to disable indented code blocks.Corroberations
"A switch that disables code blocks by indenting" at
forum.obsidian.md/t/21764
"Inline HTML breaks when using indentation" at
talk.commonmark.org/t/3317
1Add option to disable indented code blocks? jgm/pandoc#2120 (comment)
Disable markdown indented code blocks by default 11ty/eleventy#2438 (comment)
"Disable “indent -> code block”" at
forum.obsidian.md/t/19173
"Break Markdown: Option to change default tab / indent behavior / Do not create code block" at
forum.obsidian.md/t/8741/5
"This is how to use Markdown inside HTML blocks" at
forum.obsidian.md/t/74435/14
"Change the code block button from inserting indentation to triple-backticks" at
meta.stackoverflow.com/revisions/414866/1
:Reposts
Interested
Footnotes
talk.commonmark.org/t/3317/6
↩The text was updated successfully, but these errors were encountered: