-
-
Notifications
You must be signed in to change notification settings - Fork 495
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
Disable markdown indented code blocks by default #2438
Comments
This would, of course, allow folks to re-enable the feature by using markdown-it’s // Not this
// eleventyConfig.setLibrary("md", markdownIt(options).enable('code'));
// Opt-in via new 2.0 amendLibrary Configuration API method.
eleventyConfig.amendLibrary("md", mdLib => mdLib.enable('code')); |
YESSSSSS. This is such a pain point. |
But I think the problem is that now I need to figure out what Does it make more sense to add it as some new config flag? eleventyConfig.markdownCodeIndent(false); Liquid has an |
I prefer using my own code block syntax (liquid or nunjucks tag) and have been bitten by this a number of times. Totally in agreement on this. Additionally, I feel like any time something behaves unexpectedly is also a time for new users (and often newer devs) to get very confused. When magic happens, it should be more explicit. I'd be curious to know how many folks actively use tab-based code blocks. To me, that's a relatively unintuitive way of handling it on markdown's part (but that ship has sailed) |
I think this would be a very sensible default since I feel that most users don't even know about the feature and it creates a gotcha. Personally, I've been desabling the code feature in every projects. |
Just to clarify, this doesn't break code blocks or inline code, right? I tried it out and it seems to work fine, and I'm also 100% in support of this since it's bitten me way too many times. I do agree that it's probably better to stick it behind an option, though, and maybe set it to |
@AleksandrHovhannisyan correct, the traditional method (triple backtick) for code blocks and inline code (single backtick) in Markdown both still work when Enabling or disabling the triple backtick feature is referenced as |
Per your comment @pdehaan I think this might be a good option if the feature had some modicum of popularity 😅. From the feedback here so far, it seems universally hated 😳 (and to be fair, same from me) #2438 (comment) |
Agreed, the "indent for code" was a mistake in the design of Markdown IMO. Get rid! :) |
Yes please. Omitting indented code blocks is the major divergence that Bikeshed-flavored Markdown makes from CommonMark as well; it's a terrible misfeature on it's own and is even worse when combined with markup. |
Huge support for this. |
Yes, yes, 100% yes. Possum paws up for this. This is such an unknown markdown feature, that the unintended problems it causes are rarely attributed to it. I think this is a wonderful quality of life improvement. |
Whew, time to issue a mercy rule on this one. It’ll ship with 2.0.0-canary.12 |
Opt-ing back into this feature will be a little trickier than I suggested earlier, I went pretty hard on this default based on how the existing Markdown documentation looks with
Put plainly, this calls So, to opt-back-in I added a new (multi-template-language) configuration API method called Here’s what that looks like for this feature specifically: // Opt-back-in via new 2.0 amendLibrary Configuration API method.
eleventyConfig.amendLibrary("md", mdLib => mdLib.enable('code')); But this will also simplify markdown-it plugins too, so you don’t have to know anything about the existing markdown-it options or passing those in (credit to @pdehaan above for that callout) const mdEmoji = require("markdown-it-emoji");
module.exports = function(eleventyConfig) {
eleventyConfig.amendLibrary("md", mdLib => mdLib.use(mdEmoji));
}; |
Woo-hoo! 🥳 This has bitten me way too many times. Should the pitfall docs also be updated to mention that |
Yeah @AleksandrHovhannisyan I’m updating the docs as we speak/type 🙌🏻 |
This just bit me again, thanks for the reminder of what the problem is. |
I LOVE this! I was running my own fork of MarkdownIt because of this and I'm very glad Eleventy 2.0 has a better way to disable it. |
Urgh. I just got bitten by that change. Totally fine to change the default, but not so great when one passes in a configured parser via Gladly the workaround is well documented (thanks!) but
feels ugly as hell. |
Has anyone experienced markdown-it/markdown-it#1014 (comment) since this change? Confirming before I recommend Eleventy to someone. |
In markdown there is a specific feature called Indented Code Blocks that causes much confusion! We have a big warning on the docs about it.
https://www.11ty.dev/docs/languages/markdown/#there-are-extra-and-in-my-output
Awhile back @drewm posted a lovely workaround to opt-out of this feature.
https://twitter.com/drewm/status/1167821259662663682
I’d like to change the default Eleventy behavior to do this as well. Maybe even in 2.0 👀
Related: #402 #180 #1971 (#1635 maybe) and part of https://twitter.com/brob/status/1530620544680337412 from @brob and probably a bunch of others
The text was updated successfully, but these errors were encountered: