From a7744f8c1b86bf22f2d0c228bcfb89fbd173a834 Mon Sep 17 00:00:00 2001 From: PigeonsHouse Date: Mon, 11 Dec 2023 20:27:06 +0900 Subject: [PATCH] =?UTF-8?q?add:=20=E5=90=8D=E5=89=8D=E4=BB=98=E3=81=8D?= =?UTF-8?q?=E3=82=B3=E3=83=BC=E3=83=89=E3=83=96=E3=83=AD=E3=83=83=E3=82=AF?= =?UTF-8?q?=E3=81=AB=E5=90=8D=E5=89=8D=E3=82=92=E8=A1=A8=E7=A4=BA=E3=81=99?= =?UTF-8?q?=E3=82=8B=E3=82=88=E3=81=86=E3=82=A2=E3=83=83=E3=83=97=E3=83=87?= =?UTF-8?q?=E3=83=BC=E3=83=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 148 ++++++++++++++++++++++++++++++++++++++++++ package.json | 1 + pages/blog/_id.vue | 18 ++++- plugins/markdownit.js | 2 + 4 files changed, 168 insertions(+), 1 deletion(-) diff --git a/package-lock.json b/package-lock.json index b894978..5b52182 100644 --- a/package-lock.json +++ b/package-lock.json @@ -22,6 +22,7 @@ "katex": "^0.16.3", "markdown-it": "^13.0.1", "markdown-it-anchor": "^8.6.7", + "markdown-it-named-code-blocks": "^0.2.0", "markdown-it-texmath": "^1.0.0", "nuxt": "^2.15.7", "nuxt-fontawesome": "^0.4.0", @@ -13499,6 +13500,89 @@ "markdown-it": "*" } }, + "node_modules/markdown-it-named-code-blocks": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/markdown-it-named-code-blocks/-/markdown-it-named-code-blocks-0.2.0.tgz", + "integrity": "sha512-NvZJU3zREjIggiUq1Uq8dh/tTS9drmSMgkDbP2KmEhPdUaNqqgw3IxkRnd83ai4dt485/4Y/08NpcWrruYQ/6Q==", + "dependencies": { + "node-html-parser": "^6.1.5" + } + }, + "node_modules/markdown-it-named-code-blocks/node_modules/css-select": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/css-select/-/css-select-5.1.0.tgz", + "integrity": "sha512-nwoRF1rvRRnnCqqY7updORDsuqKzqYJ28+oSMaJMMgOauh3fvwHqMS7EZpIPqK8GL+g9mKxF1vP/ZjSeNjEVHg==", + "dependencies": { + "boolbase": "^1.0.0", + "css-what": "^6.1.0", + "domhandler": "^5.0.2", + "domutils": "^3.0.1", + "nth-check": "^2.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/fb55" + } + }, + "node_modules/markdown-it-named-code-blocks/node_modules/dom-serializer": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-2.0.0.tgz", + "integrity": "sha512-wIkAryiqt/nV5EQKqQpo3SToSOV9J0DnbJqwK7Wv/Trc92zIAYZ4FlMu+JPFW1DfGFt81ZTCGgDEabffXeLyJg==", + "dependencies": { + "domelementtype": "^2.3.0", + "domhandler": "^5.0.2", + "entities": "^4.2.0" + }, + "funding": { + "url": "https://github.com/cheeriojs/dom-serializer?sponsor=1" + } + }, + "node_modules/markdown-it-named-code-blocks/node_modules/domhandler": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-5.0.3.tgz", + "integrity": "sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w==", + "dependencies": { + "domelementtype": "^2.3.0" + }, + "engines": { + "node": ">= 4" + }, + "funding": { + "url": "https://github.com/fb55/domhandler?sponsor=1" + } + }, + "node_modules/markdown-it-named-code-blocks/node_modules/domutils": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/domutils/-/domutils-3.1.0.tgz", + "integrity": "sha512-H78uMmQtI2AhgDJjWeQmHwJJ2bLPD3GMmO7Zja/ZZh84wkm+4ut+IUnUdRa8uCGX88DiVx1j6FRe1XfxEgjEZA==", + "dependencies": { + "dom-serializer": "^2.0.0", + "domelementtype": "^2.3.0", + "domhandler": "^5.0.3" + }, + "funding": { + "url": "https://github.com/fb55/domutils?sponsor=1" + } + }, + "node_modules/markdown-it-named-code-blocks/node_modules/entities": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", + "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==", + "engines": { + "node": ">=0.12" + }, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, + "node_modules/markdown-it-named-code-blocks/node_modules/node-html-parser": { + "version": "6.1.11", + "resolved": "https://registry.npmjs.org/node-html-parser/-/node-html-parser-6.1.11.tgz", + "integrity": "sha512-FAgwwZ6h0DSDWxfD0Iq1tsDcBCxdJB1nXpLPPxX8YyVWzbfCjKWEzaynF4gZZ/8hziUmp7ZSaKylcn0iKhufUQ==", + "dependencies": { + "css-select": "^5.1.0", + "he": "1.2.0" + } + }, "node_modules/markdown-it-texmath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/markdown-it-texmath/-/markdown-it-texmath-1.0.0.tgz", @@ -31132,6 +31216,70 @@ "integrity": "sha512-FlCHFwNnutLgVTflOYHPW2pPcl2AACqVzExlkGQNsi4CJgqOHN7YTgDd4LuhgN1BFO3TS0vLAruV1Td6dwWPJA==", "requires": {} }, + "markdown-it-named-code-blocks": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/markdown-it-named-code-blocks/-/markdown-it-named-code-blocks-0.2.0.tgz", + "integrity": "sha512-NvZJU3zREjIggiUq1Uq8dh/tTS9drmSMgkDbP2KmEhPdUaNqqgw3IxkRnd83ai4dt485/4Y/08NpcWrruYQ/6Q==", + "requires": { + "node-html-parser": "^6.1.5" + }, + "dependencies": { + "css-select": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/css-select/-/css-select-5.1.0.tgz", + "integrity": "sha512-nwoRF1rvRRnnCqqY7updORDsuqKzqYJ28+oSMaJMMgOauh3fvwHqMS7EZpIPqK8GL+g9mKxF1vP/ZjSeNjEVHg==", + "requires": { + "boolbase": "^1.0.0", + "css-what": "^6.1.0", + "domhandler": "^5.0.2", + "domutils": "^3.0.1", + "nth-check": "^2.0.1" + } + }, + "dom-serializer": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-2.0.0.tgz", + "integrity": "sha512-wIkAryiqt/nV5EQKqQpo3SToSOV9J0DnbJqwK7Wv/Trc92zIAYZ4FlMu+JPFW1DfGFt81ZTCGgDEabffXeLyJg==", + "requires": { + "domelementtype": "^2.3.0", + "domhandler": "^5.0.2", + "entities": "^4.2.0" + } + }, + "domhandler": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-5.0.3.tgz", + "integrity": "sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w==", + "requires": { + "domelementtype": "^2.3.0" + } + }, + "domutils": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/domutils/-/domutils-3.1.0.tgz", + "integrity": "sha512-H78uMmQtI2AhgDJjWeQmHwJJ2bLPD3GMmO7Zja/ZZh84wkm+4ut+IUnUdRa8uCGX88DiVx1j6FRe1XfxEgjEZA==", + "requires": { + "dom-serializer": "^2.0.0", + "domelementtype": "^2.3.0", + "domhandler": "^5.0.3" + } + }, + "entities": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", + "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==" + }, + "node-html-parser": { + "version": "6.1.11", + "resolved": "https://registry.npmjs.org/node-html-parser/-/node-html-parser-6.1.11.tgz", + "integrity": "sha512-FAgwwZ6h0DSDWxfD0Iq1tsDcBCxdJB1nXpLPPxX8YyVWzbfCjKWEzaynF4gZZ/8hziUmp7ZSaKylcn0iKhufUQ==", + "requires": { + "css-select": "^5.1.0", + "he": "1.2.0" + } + } + } + }, "markdown-it-texmath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/markdown-it-texmath/-/markdown-it-texmath-1.0.0.tgz", diff --git a/package.json b/package.json index ecc56fe..270a0bc 100644 --- a/package.json +++ b/package.json @@ -27,6 +27,7 @@ "katex": "^0.16.3", "markdown-it": "^13.0.1", "markdown-it-anchor": "^8.6.7", + "markdown-it-named-code-blocks": "^0.2.0", "markdown-it-texmath": "^1.0.0", "nuxt": "^2.15.7", "nuxt-fontawesome": "^0.4.0", diff --git a/pages/blog/_id.vue b/pages/blog/_id.vue index 77f3cd8..b5c3071 100644 --- a/pages/blog/_id.vue +++ b/pages/blog/_id.vue @@ -154,10 +154,26 @@ export default Vue.extend({ margin: 0 auto; } - diff --git a/plugins/markdownit.js b/plugins/markdownit.js index 81159f0..3aae382 100644 --- a/plugins/markdownit.js +++ b/plugins/markdownit.js @@ -3,6 +3,7 @@ import 'katex/dist/katex.min.css' import katex from 'katex' import tm from 'markdown-it-texmath' import anchor from 'markdown-it-anchor' +import namedCodeBlocks from 'markdown-it-named-code-blocks' export default ({ app }, inject) => { const md = new MarkdownIt({ @@ -32,6 +33,7 @@ export default ({ app }, inject) => { katexOptions: { macros: { '\\RR': '\\mathbb{R}' } }, }) md.use(anchor, {}) + md.use(namedCodeBlocks, {}) inject('md', md) }