Enable code blocks plugin

This commit is contained in:
Marcus Blättermann 2022-11-25 02:39:21 +01:00
parent ab2946c082
commit 799013c4cf
No known key found for this signature in database
GPG Key ID: A1E1F04008AC450D
4 changed files with 17 additions and 3 deletions

View File

@ -21,6 +21,7 @@
"eslint-config-next": "13.0.2", "eslint-config-next": "13.0.2",
"html-to-react": "^1.5.0", "html-to-react": "^1.5.0",
"jinja-to-js": "^3.2.3", "jinja-to-js": "^3.2.3",
"md-attr-parser": "^1.3.0",
"next": "13.0.2", "next": "13.0.2",
"next-mdx-remote": "^4.2.0", "next-mdx-remote": "^4.2.0",
"prettier": "^2.7.1", "prettier": "^2.7.1",
@ -2976,6 +2977,11 @@
"url": "https://github.com/sponsors/wooorm" "url": "https://github.com/sponsors/wooorm"
} }
}, },
"node_modules/md-attr-parser": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/md-attr-parser/-/md-attr-parser-1.3.0.tgz",
"integrity": "sha512-KTVlfU5Oxo/6kd0YZ2mLP3eWJj+5vzh5mBCxLo3yGl1fzHIgxmtadbE9tHb7TbUBi3XZbl+P0xKeGmakat135w=="
},
"node_modules/mdast-util-definitions": { "node_modules/mdast-util-definitions": {
"version": "5.1.1", "version": "5.1.1",
"resolved": "https://registry.npmjs.org/mdast-util-definitions/-/mdast-util-definitions-5.1.1.tgz", "resolved": "https://registry.npmjs.org/mdast-util-definitions/-/mdast-util-definitions-5.1.1.tgz",
@ -7904,6 +7910,11 @@
"resolved": "https://registry.npmjs.org/markdown-table/-/markdown-table-3.0.2.tgz", "resolved": "https://registry.npmjs.org/markdown-table/-/markdown-table-3.0.2.tgz",
"integrity": "sha512-y8j3a5/DkJCmS5x4dMCQL+OR0+2EAq3DOtio1COSHsmW2BGXnNCK3v12hJt1LrUz5iZH5g0LmuYOjDdI+czghA==" "integrity": "sha512-y8j3a5/DkJCmS5x4dMCQL+OR0+2EAq3DOtio1COSHsmW2BGXnNCK3v12hJt1LrUz5iZH5g0LmuYOjDdI+czghA=="
}, },
"md-attr-parser": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/md-attr-parser/-/md-attr-parser-1.3.0.tgz",
"integrity": "sha512-KTVlfU5Oxo/6kd0YZ2mLP3eWJj+5vzh5mBCxLo3yGl1fzHIgxmtadbE9tHb7TbUBi3XZbl+P0xKeGmakat135w=="
},
"mdast-util-definitions": { "mdast-util-definitions": {
"version": "5.1.1", "version": "5.1.1",
"resolved": "https://registry.npmjs.org/mdast-util-definitions/-/mdast-util-definitions-5.1.1.tgz", "resolved": "https://registry.npmjs.org/mdast-util-definitions/-/mdast-util-definitions-5.1.1.tgz",

View File

@ -24,6 +24,7 @@
"eslint-config-next": "13.0.2", "eslint-config-next": "13.0.2",
"html-to-react": "^1.5.0", "html-to-react": "^1.5.0",
"jinja-to-js": "^3.2.3", "jinja-to-js": "^3.2.3",
"md-attr-parser": "^1.3.0",
"next": "13.0.2", "next": "13.0.2",
"next-mdx-remote": "^4.2.0", "next-mdx-remote": "^4.2.0",
"prettier": "^2.7.1", "prettier": "^2.7.1",

View File

@ -3,11 +3,13 @@ import remarkUnwrapImages from 'remark-unwrap-images'
import remarkCustomAttrs from './remarkCustomAttrs.mjs' import remarkCustomAttrs from './remarkCustomAttrs.mjs'
import remarkWrapSections from './remarkWrapSections.mjs' import remarkWrapSections from './remarkWrapSections.mjs'
import remarkCodeBlocks from './remarkCodeBlocks.mjs'
const remarkPlugins = [ const remarkPlugins = [
remarkGfm, remarkGfm,
remarkUnwrapImages, remarkUnwrapImages,
remarkCustomAttrs, remarkCustomAttrs,
remarkCodeBlocks,
remarkWrapSections, remarkWrapSections,
] ]

View File

@ -2,8 +2,8 @@
* Support titles, line highlights and more for code blocks * Support titles, line highlights and more for code blocks
*/ */
const visit = require('unist-util-visit') import { visit } from 'unist-util-visit'
const parseAttr = require('md-attr-parser') import parseAttr from 'md-attr-parser'
const defaultOptions = { const defaultOptions = {
defaultPrefix: '###', defaultPrefix: '###',
@ -71,4 +71,4 @@ function remarkCodeBlocks(userOptions = {}) {
return transformer return transformer
} }
module.exports = remarkCodeBlocks export default remarkCodeBlocks