From 7ec843b4e1f40396b85a44f336b7599aa0ebc1a1 Mon Sep 17 00:00:00 2001 From: "Nicholas C. Zakas" Date: Tue, 14 Jun 2022 15:11:48 -0700 Subject: [PATCH] chore: Enable containers (#950) * chore: Enable containers * Update _11ty/plugins/markdown-plugins.js Co-authored-by: Milos Djermanovic * Fix semi.md Co-authored-by: Milos Djermanovic --- _11ty/plugins/markdown-plugins.js | 6 ++++++ docs/rules/semi.md | 28 ++++++++++++++++++++++++++++ package-lock.json | 13 +++++++++++++ package.json | 1 + src/styles/lib/overrides.less | 11 ----------- 5 files changed, 48 insertions(+), 11 deletions(-) diff --git a/_11ty/plugins/markdown-plugins.js b/_11ty/plugins/markdown-plugins.js index ff1dce6717..cf9a9d8fb6 100644 --- a/_11ty/plugins/markdown-plugins.js +++ b/_11ty/plugins/markdown-plugins.js @@ -1,6 +1,7 @@ "use strict"; const markdownIt = require("markdown-it"); +const markdownItContainer = require("markdown-it-container"); const highlightJS = require("highlight.js"); const { slug } = require("github-slugger"); @@ -38,5 +39,10 @@ module.exports = function syntaxHighlighting(eleventyConfig) { uniqueSlugStartIndex: 1 }); + // add markdown containers + md = md + .use(markdownItContainer, "correct", {}) + .use(markdownItContainer, "incorrect", {}); + eleventyConfig.setLibrary("md", md); }; diff --git a/docs/rules/semi.md b/docs/rules/semi.md index e9c48d69f8..ec3d2e2a53 100644 --- a/docs/rules/semi.md +++ b/docs/rules/semi.md @@ -100,6 +100,8 @@ Object option (when `"never"`): Examples of **incorrect** code for this rule with the default `"always"` option: +::: incorrect + ```js /*eslint semi: ["error", "always"]*/ @@ -114,8 +116,12 @@ class Foo { } ``` +::: + Examples of **correct** code for this rule with the default `"always"` option: +::: correct + ```js /*eslint semi: "error"*/ @@ -130,10 +136,14 @@ class Foo { } ``` +::: + ### never Examples of **incorrect** code for this rule with the `"never"` option: +::: incorrect + ```js /*eslint semi: ["error", "never"]*/ @@ -148,8 +158,12 @@ class Foo { } ``` +::: + Examples of **correct** code for this rule with the `"never"` option: +::: correct + ```js /*eslint semi: ["error", "never"]*/ @@ -180,10 +194,14 @@ class Foo { } ``` +::: + #### omitLastInOneLineBlock Examples of additional **correct** code for this rule with the `"always", { "omitLastInOneLineBlock": true }` options: +::: correct + ```js /*eslint semi: ["error", "always", { "omitLastInOneLineBlock": true}] */ @@ -200,10 +218,14 @@ class C { } ``` +::: + #### beforeStatementContinuationChars Examples of additional **incorrect** code for this rule with the `"never", { "beforeStatementContinuationChars": "always" }` options: +::: incorrect + ```js /*eslint semi: ["error", "never", { "beforeStatementContinuationChars": "always"}] */ import a from "a" @@ -213,8 +235,12 @@ import a from "a" })() ``` +::: + Examples of additional **incorrect** code for this rule with the `"never", { "beforeStatementContinuationChars": "never" }` options: +::: incorrect + ```js /*eslint semi: ["error", "never", { "beforeStatementContinuationChars": "never"}] */ import a from "a" @@ -224,6 +250,8 @@ import a from "a" })() ``` +::: + ## When Not To Use It If you do not want to enforce semicolon usage (or omission) in any particular way, then you can turn this rule off. diff --git a/package-lock.json b/package-lock.json index f68c7d8581..5774f6318c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -50,6 +50,7 @@ "luxon": "^1.24.1", "markdown-it": "^12.3.2", "markdown-it-anchor": "^6.0.0", + "markdown-it-container": "^3.0.0", "morgan": "^1.10.0", "node-fetch": "^2.6.7", "node-polyfill-webpack-plugin": "^1.0.3", @@ -7699,6 +7700,12 @@ "markdown-it": "*" } }, + "node_modules/markdown-it-container": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/markdown-it-container/-/markdown-it-container-3.0.0.tgz", + "integrity": "sha512-y6oKTq4BB9OQuY/KLfk/O3ysFhB3IMYoIWhGJEidXt1NQFocFK2sA2t0NYZAMyMShAGL6x5OPIbrmXPIqaN9rw==", + "dev": true + }, "node_modules/markdown-it/node_modules/argparse": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", @@ -17567,6 +17574,12 @@ "dev": true, "requires": {} }, + "markdown-it-container": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/markdown-it-container/-/markdown-it-container-3.0.0.tgz", + "integrity": "sha512-y6oKTq4BB9OQuY/KLfk/O3ysFhB3IMYoIWhGJEidXt1NQFocFK2sA2t0NYZAMyMShAGL6x5OPIbrmXPIqaN9rw==", + "dev": true + }, "maximatch": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/maximatch/-/maximatch-0.1.0.tgz", diff --git a/package.json b/package.json index f72f56edcd..9ec84e33e1 100644 --- a/package.json +++ b/package.json @@ -70,6 +70,7 @@ "luxon": "^1.24.1", "markdown-it": "^12.3.2", "markdown-it-anchor": "^6.0.0", + "markdown-it-container": "^3.0.0", "morgan": "^1.10.0", "node-fetch": "^2.6.7", "node-polyfill-webpack-plugin": "^1.0.3", diff --git a/src/styles/lib/overrides.less b/src/styles/lib/overrides.less index e395eb9b17..8e26d8ea42 100644 --- a/src/styles/lib/overrides.less +++ b/src/styles/lib/overrides.less @@ -49,17 +49,6 @@ body { } p { - &.incorrect + div + div + div > pre, /* vars-on-top */ - &.incorrect + div + div > pre, /* no-continue */ - &.incorrect + div > pre { - background-color: #fff6f6; /* hsl(0,100%,98%) light red */ - } - - &.correct + div + div + div > pre, /* vars-on-top */ - &.correct + div + div > pre, /* no-continue */ - &.correct + div > pre { - background-color: #f6fff6; /* hsl(120,100%,98%) light green */ - } &.icon { position:relative;