Added GFLM features + removed it from the languages list
This commit is contained in:
parent
1a8e667944
commit
2809dc6295
|
@ -43,6 +43,7 @@
|
|||
"lodash-es": "^4.17.21",
|
||||
"rehype-highlight": "^7.0.0",
|
||||
"rehype-stringify": "^10.0.0",
|
||||
"remark-gfm": "^4.0.0",
|
||||
"remark-parse": "^11.0.0",
|
||||
"remark-rehype": "^11.0.0",
|
||||
"sass": "^1.69.5",
|
||||
|
|
207
pnpm-lock.yaml
207
pnpm-lock.yaml
|
@ -29,6 +29,9 @@ dependencies:
|
|||
rehype-stringify:
|
||||
specifier: ^10.0.0
|
||||
version: 10.0.0
|
||||
remark-gfm:
|
||||
specifier: ^4.0.0
|
||||
version: 4.0.0
|
||||
remark-parse:
|
||||
specifier: ^11.0.0
|
||||
version: 11.0.0
|
||||
|
@ -1121,6 +1124,11 @@ packages:
|
|||
engines: {node: '>=10'}
|
||||
dev: true
|
||||
|
||||
/escape-string-regexp@5.0.0:
|
||||
resolution: {integrity: sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==}
|
||||
engines: {node: '>=12'}
|
||||
dev: false
|
||||
|
||||
/eslint-config-prettier@8.5.0(eslint@8.28.0):
|
||||
resolution: {integrity: sha512-obmWKLUNCnhtQRKc+tmnYuQl0pFU1ibYJQ5BGhTVB08bHe9wC8qUeG7c08dj9XX+AuPj1YSGSQIHl1pnDHZR0Q==}
|
||||
hasBin: true
|
||||
|
@ -1709,6 +1717,10 @@ packages:
|
|||
resolution: {integrity: sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==}
|
||||
dev: true
|
||||
|
||||
/longest-streak@3.1.0:
|
||||
resolution: {integrity: sha512-9Ri+o0JYgehTaVBBDoMqIl8GXtbWg711O3srftcHhZ0dqnETqLaoIK0x17fUw9rFSlK/0NlsKe0Ahhyl5pXE2g==}
|
||||
dev: false
|
||||
|
||||
/lowlight@3.1.0:
|
||||
resolution: {integrity: sha512-CEbNVoSikAxwDMDPjXlqlFYiZLkDJHwyGu/MfOsJnF3d7f3tds5J3z8s/l9TMXhzfsJCCJEAsD78842mwmg0PQ==}
|
||||
dependencies:
|
||||
|
@ -1737,6 +1749,19 @@ packages:
|
|||
dependencies:
|
||||
'@jridgewell/sourcemap-codec': 1.4.15
|
||||
|
||||
/markdown-table@3.0.3:
|
||||
resolution: {integrity: sha512-Z1NL3Tb1M9wH4XESsCDEksWoKTdlUafKc4pt0GRwjUyXaCFZ+dc3g2erqB6zm3szA2IUSi7VnPI+o/9jnxh9hw==}
|
||||
dev: false
|
||||
|
||||
/mdast-util-find-and-replace@3.0.1:
|
||||
resolution: {integrity: sha512-SG21kZHGC3XRTSUhtofZkBzZTJNM5ecCi0SK2IMKmSXR8vO3peL+kb1O0z7Zl83jKtutG4k5Wv/W7V3/YHvzPA==}
|
||||
dependencies:
|
||||
'@types/mdast': 4.0.3
|
||||
escape-string-regexp: 5.0.0
|
||||
unist-util-is: 6.0.0
|
||||
unist-util-visit-parents: 6.0.1
|
||||
dev: false
|
||||
|
||||
/mdast-util-from-markdown@2.0.0:
|
||||
resolution: {integrity: sha512-n7MTOr/z+8NAX/wmhhDji8O3bRvPTV/U0oTCaZJkjhPSKTPhS3xufVhKGF8s1pJ7Ox4QgoIU7KHseh09S+9rTA==}
|
||||
dependencies:
|
||||
|
@ -1756,6 +1781,82 @@ packages:
|
|||
- supports-color
|
||||
dev: false
|
||||
|
||||
/mdast-util-gfm-autolink-literal@2.0.0:
|
||||
resolution: {integrity: sha512-FyzMsduZZHSc3i0Px3PQcBT4WJY/X/RCtEJKuybiC6sjPqLv7h1yqAkmILZtuxMSsUyaLUWNp71+vQH2zqp5cg==}
|
||||
dependencies:
|
||||
'@types/mdast': 4.0.3
|
||||
ccount: 2.0.1
|
||||
devlop: 1.1.0
|
||||
mdast-util-find-and-replace: 3.0.1
|
||||
micromark-util-character: 2.0.1
|
||||
dev: false
|
||||
|
||||
/mdast-util-gfm-footnote@2.0.0:
|
||||
resolution: {integrity: sha512-5jOT2boTSVkMnQ7LTrd6n/18kqwjmuYqo7JUPe+tRCY6O7dAuTFMtTPauYYrMPpox9hlN0uOx/FL8XvEfG9/mQ==}
|
||||
dependencies:
|
||||
'@types/mdast': 4.0.3
|
||||
devlop: 1.1.0
|
||||
mdast-util-from-markdown: 2.0.0
|
||||
mdast-util-to-markdown: 2.1.0
|
||||
micromark-util-normalize-identifier: 2.0.0
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
dev: false
|
||||
|
||||
/mdast-util-gfm-strikethrough@2.0.0:
|
||||
resolution: {integrity: sha512-mKKb915TF+OC5ptj5bJ7WFRPdYtuHv0yTRxK2tJvi+BDqbkiG7h7u/9SI89nRAYcmap2xHQL9D+QG/6wSrTtXg==}
|
||||
dependencies:
|
||||
'@types/mdast': 4.0.3
|
||||
mdast-util-from-markdown: 2.0.0
|
||||
mdast-util-to-markdown: 2.1.0
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
dev: false
|
||||
|
||||
/mdast-util-gfm-table@2.0.0:
|
||||
resolution: {integrity: sha512-78UEvebzz/rJIxLvE7ZtDd/vIQ0RHv+3Mh5DR96p7cS7HsBhYIICDBCu8csTNWNO6tBWfqXPWekRuj2FNOGOZg==}
|
||||
dependencies:
|
||||
'@types/mdast': 4.0.3
|
||||
devlop: 1.1.0
|
||||
markdown-table: 3.0.3
|
||||
mdast-util-from-markdown: 2.0.0
|
||||
mdast-util-to-markdown: 2.1.0
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
dev: false
|
||||
|
||||
/mdast-util-gfm-task-list-item@2.0.0:
|
||||
resolution: {integrity: sha512-IrtvNvjxC1o06taBAVJznEnkiHxLFTzgonUdy8hzFVeDun0uTjxxrRGVaNFqkU1wJR3RBPEfsxmU6jDWPofrTQ==}
|
||||
dependencies:
|
||||
'@types/mdast': 4.0.3
|
||||
devlop: 1.1.0
|
||||
mdast-util-from-markdown: 2.0.0
|
||||
mdast-util-to-markdown: 2.1.0
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
dev: false
|
||||
|
||||
/mdast-util-gfm@3.0.0:
|
||||
resolution: {integrity: sha512-dgQEX5Amaq+DuUqf26jJqSK9qgixgd6rYDHAv4aTBuA92cTknZlKpPfa86Z/s8Dj8xsAQpFfBmPUHWJBWqS4Bw==}
|
||||
dependencies:
|
||||
mdast-util-from-markdown: 2.0.0
|
||||
mdast-util-gfm-autolink-literal: 2.0.0
|
||||
mdast-util-gfm-footnote: 2.0.0
|
||||
mdast-util-gfm-strikethrough: 2.0.0
|
||||
mdast-util-gfm-table: 2.0.0
|
||||
mdast-util-gfm-task-list-item: 2.0.0
|
||||
mdast-util-to-markdown: 2.1.0
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
dev: false
|
||||
|
||||
/mdast-util-phrasing@4.0.0:
|
||||
resolution: {integrity: sha512-xadSsJayQIucJ9n053dfQwVu1kuXg7jCTdYsMK8rqzKZh52nLfSH/k0sAxE0u+pj/zKZX+o5wB+ML5mRayOxFA==}
|
||||
dependencies:
|
||||
'@types/mdast': 4.0.3
|
||||
unist-util-is: 6.0.0
|
||||
dev: false
|
||||
|
||||
/mdast-util-to-hast@13.0.2:
|
||||
resolution: {integrity: sha512-U5I+500EOOw9e3ZrclN3Is3fRpw8c19SMyNZlZ2IS+7vLsNzb2Om11VpIVOR+/0137GhZsFEF6YiKD5+0Hr2Og==}
|
||||
dependencies:
|
||||
|
@ -1769,6 +1870,19 @@ packages:
|
|||
unist-util-visit: 5.0.0
|
||||
dev: false
|
||||
|
||||
/mdast-util-to-markdown@2.1.0:
|
||||
resolution: {integrity: sha512-SR2VnIEdVNCJbP6y7kVTJgPLifdr8WEU440fQec7qHoHOUz/oJ2jmNRqdDQ3rbiStOXb2mCDGTuwsK5OPUgYlQ==}
|
||||
dependencies:
|
||||
'@types/mdast': 4.0.3
|
||||
'@types/unist': 3.0.2
|
||||
longest-streak: 3.1.0
|
||||
mdast-util-phrasing: 4.0.0
|
||||
mdast-util-to-string: 4.0.0
|
||||
micromark-util-decode-string: 2.0.0
|
||||
unist-util-visit: 5.0.0
|
||||
zwitch: 2.0.4
|
||||
dev: false
|
||||
|
||||
/mdast-util-to-string@4.0.0:
|
||||
resolution: {integrity: sha512-0H44vDimn51F0YwvxSJSm0eCDOJTRlmN0R1yBh4HLj9wiV1Dn0QoXGbvFAWj2hSItVTlCmBF1hqKlIyUBVFLPg==}
|
||||
dependencies:
|
||||
|
@ -1803,6 +1917,78 @@ packages:
|
|||
micromark-util-types: 2.0.0
|
||||
dev: false
|
||||
|
||||
/micromark-extension-gfm-autolink-literal@2.0.0:
|
||||
resolution: {integrity: sha512-rTHfnpt/Q7dEAK1Y5ii0W8bhfJlVJFnJMHIPisfPK3gpVNuOP0VnRl96+YJ3RYWV/P4gFeQoGKNlT3RhuvpqAg==}
|
||||
dependencies:
|
||||
micromark-util-character: 2.0.1
|
||||
micromark-util-sanitize-uri: 2.0.0
|
||||
micromark-util-symbol: 2.0.0
|
||||
micromark-util-types: 2.0.0
|
||||
dev: false
|
||||
|
||||
/micromark-extension-gfm-footnote@2.0.0:
|
||||
resolution: {integrity: sha512-6Rzu0CYRKDv3BfLAUnZsSlzx3ak6HAoI85KTiijuKIz5UxZxbUI+pD6oHgw+6UtQuiRwnGRhzMmPRv4smcz0fg==}
|
||||
dependencies:
|
||||
devlop: 1.1.0
|
||||
micromark-core-commonmark: 2.0.0
|
||||
micromark-factory-space: 2.0.0
|
||||
micromark-util-character: 2.0.1
|
||||
micromark-util-normalize-identifier: 2.0.0
|
||||
micromark-util-sanitize-uri: 2.0.0
|
||||
micromark-util-symbol: 2.0.0
|
||||
micromark-util-types: 2.0.0
|
||||
dev: false
|
||||
|
||||
/micromark-extension-gfm-strikethrough@2.0.0:
|
||||
resolution: {integrity: sha512-c3BR1ClMp5fxxmwP6AoOY2fXO9U8uFMKs4ADD66ahLTNcwzSCyRVU4k7LPV5Nxo/VJiR4TdzxRQY2v3qIUceCw==}
|
||||
dependencies:
|
||||
devlop: 1.1.0
|
||||
micromark-util-chunked: 2.0.0
|
||||
micromark-util-classify-character: 2.0.0
|
||||
micromark-util-resolve-all: 2.0.0
|
||||
micromark-util-symbol: 2.0.0
|
||||
micromark-util-types: 2.0.0
|
||||
dev: false
|
||||
|
||||
/micromark-extension-gfm-table@2.0.0:
|
||||
resolution: {integrity: sha512-PoHlhypg1ItIucOaHmKE8fbin3vTLpDOUg8KAr8gRCF1MOZI9Nquq2i/44wFvviM4WuxJzc3demT8Y3dkfvYrw==}
|
||||
dependencies:
|
||||
devlop: 1.1.0
|
||||
micromark-factory-space: 2.0.0
|
||||
micromark-util-character: 2.0.1
|
||||
micromark-util-symbol: 2.0.0
|
||||
micromark-util-types: 2.0.0
|
||||
dev: false
|
||||
|
||||
/micromark-extension-gfm-tagfilter@2.0.0:
|
||||
resolution: {integrity: sha512-xHlTOmuCSotIA8TW1mDIM6X2O1SiX5P9IuDtqGonFhEK0qgRI4yeC6vMxEV2dgyr2TiD+2PQ10o+cOhdVAcwfg==}
|
||||
dependencies:
|
||||
micromark-util-types: 2.0.0
|
||||
dev: false
|
||||
|
||||
/micromark-extension-gfm-task-list-item@2.0.1:
|
||||
resolution: {integrity: sha512-cY5PzGcnULaN5O7T+cOzfMoHjBW7j+T9D2sucA5d/KbsBTPcYdebm9zUd9zzdgJGCwahV+/W78Z3nbulBYVbTw==}
|
||||
dependencies:
|
||||
devlop: 1.1.0
|
||||
micromark-factory-space: 2.0.0
|
||||
micromark-util-character: 2.0.1
|
||||
micromark-util-symbol: 2.0.0
|
||||
micromark-util-types: 2.0.0
|
||||
dev: false
|
||||
|
||||
/micromark-extension-gfm@3.0.0:
|
||||
resolution: {integrity: sha512-vsKArQsicm7t0z2GugkCKtZehqUm31oeGBV/KVSorWSy8ZlNAv7ytjFhvaryUiCUJYqs+NoE6AFhpQvBTM6Q4w==}
|
||||
dependencies:
|
||||
micromark-extension-gfm-autolink-literal: 2.0.0
|
||||
micromark-extension-gfm-footnote: 2.0.0
|
||||
micromark-extension-gfm-strikethrough: 2.0.0
|
||||
micromark-extension-gfm-table: 2.0.0
|
||||
micromark-extension-gfm-tagfilter: 2.0.0
|
||||
micromark-extension-gfm-task-list-item: 2.0.1
|
||||
micromark-util-combine-extensions: 2.0.0
|
||||
micromark-util-types: 2.0.0
|
||||
dev: false
|
||||
|
||||
/micromark-factory-destination@2.0.0:
|
||||
resolution: {integrity: sha512-j9DGrQLm/Uhl2tCzcbLhy5kXsgkHUrjJHg4fFAeoMRwJmJerT9aw4FEhIbZStWN8A3qMwOp1uzHr4UL8AInxtA==}
|
||||
dependencies:
|
||||
|
@ -2327,6 +2513,19 @@ packages:
|
|||
unified: 11.0.4
|
||||
dev: false
|
||||
|
||||
/remark-gfm@4.0.0:
|
||||
resolution: {integrity: sha512-U92vJgBPkbw4Zfu/IiW2oTZLSL3Zpv+uI7My2eq8JxKgqraFdU8YUGicEJCEgSbeaG+QDFqIcwwfMTOEelPxuA==}
|
||||
dependencies:
|
||||
'@types/mdast': 4.0.3
|
||||
mdast-util-gfm: 3.0.0
|
||||
micromark-extension-gfm: 3.0.0
|
||||
remark-parse: 11.0.0
|
||||
remark-stringify: 11.0.0
|
||||
unified: 11.0.4
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
dev: false
|
||||
|
||||
/remark-parse@11.0.0:
|
||||
resolution: {integrity: sha512-FCxlKLNGknS5ba/1lmpYijMUzX2esxW5xQqjWxw2eHFfS2MSdaHVINFmhjo+qN1WhZhNimq0dZATN9pH0IDrpA==}
|
||||
dependencies:
|
||||
|
@ -2348,6 +2547,14 @@ packages:
|
|||
vfile: 6.0.1
|
||||
dev: false
|
||||
|
||||
/remark-stringify@11.0.0:
|
||||
resolution: {integrity: sha512-1OSmLd3awB/t8qdoEOMazZkNsfVTeY4fTsgzcQFdXNq8ToTN4ZGwrMnlda4K6smTFKD+GRV6O48i6Z4iKgPPpw==}
|
||||
dependencies:
|
||||
'@types/mdast': 4.0.3
|
||||
mdast-util-to-markdown: 2.1.0
|
||||
unified: 11.0.4
|
||||
dev: false
|
||||
|
||||
/resolve-from@4.0.0:
|
||||
resolution: {integrity: sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==}
|
||||
engines: {node: '>=4'}
|
||||
|
|
|
@ -36,15 +36,19 @@
|
|||
}
|
||||
|
||||
onMount(() => {
|
||||
languages = CodeMirror.modeInfo.map((e: any) => ({
|
||||
languages = CodeMirror.modeInfo
|
||||
.map((e: any) => ({
|
||||
text: e.name,
|
||||
value: shorten(e.name),
|
||||
data: { mime: e.mime, mode: e.mode },
|
||||
}))
|
||||
.filter((l: any) => l.value !== 'gflm') // Remove github flavored markdown, redundant with markdown
|
||||
console.log(languages)
|
||||
})
|
||||
|
||||
export function setLanguage(lang: string) {
|
||||
if (lang === 'mrwn') { // back compatiblity with old links
|
||||
if (lang === 'mrwn' || lang === 'gflm') {
|
||||
// back compatiblity with old links
|
||||
lang = 'md'
|
||||
}
|
||||
const language = languages.find((e) => e.value === lang)!
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
import { unified } from 'unified'
|
||||
import remarkParse from 'remark-parse'
|
||||
import remarkRehype from 'remark-rehype'
|
||||
import remarkGfm from 'remark-gfm'
|
||||
import rehypeHighlight from 'rehype-highlight'
|
||||
import rehypeStringify from 'rehype-stringify'
|
||||
import hljs from 'highlight.js'
|
||||
|
@ -16,7 +17,7 @@
|
|||
|
||||
onMount(async () => {
|
||||
let lang = new URLSearchParams(window.location.search).get('l')
|
||||
lang = lang === 'mrwn' ? 'md' : lang // back compatiblity with old links
|
||||
lang = lang === 'mrwn' || lang === 'gflm' ? 'md' : lang // back compatiblity with old links
|
||||
|
||||
// extract the part in the url after the hash
|
||||
const hash = window.location.hash.slice(1)
|
||||
|
@ -32,6 +33,7 @@
|
|||
if (lang === 'md' || lang === 'gflm') {
|
||||
const html = await unified()
|
||||
.use(remarkParse)
|
||||
.use(remarkGfm)
|
||||
.use(remarkRehype)
|
||||
.use(rehypeHighlight)
|
||||
.use(rehypeStringify)
|
||||
|
@ -55,7 +57,6 @@
|
|||
</script>
|
||||
|
||||
<div>
|
||||
|
||||
<div class="prose dark:prose-invert lg:py-12 p-[0.5em] md:max-w-3xl md:mx-auto lg:max-w-4xl">
|
||||
{#if isMarkdown}
|
||||
{@html decompressed}
|
||||
|
|
Loading…
Reference in New Issue
Block a user