Initial commit.

This commit is contained in:
Joshua Bemenderfer
2022-08-31 22:15:07 -04:00
commit 9b5ac14082
11 changed files with 4401 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
import {unified} from 'unified'
import remarkParse from 'remark-parse'
import remarkRehype from 'remark-rehype'
import rehypeStringify from 'rehype-stringify'
export default function (line, lineData, doc) {
const blockLevel = lineData.level
let md = ''
function finalize() {
return unified()
.use(remarkParse)
.use(remarkRehype)
.use(rehypeStringify)
.process(md)
}
async function markdownContents(line, lineData, doc) {
if (lineData.level <= blockLevel) {
const final = String(await finalize())
page.body += final
return doc.repeat(baseHandler)
}
md += line.slice(blockLevel + 1) + '\n'
return doc.next(markdownContents)
}
return doc.next(markdownContents)
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,17 @@
{
"name": "@terrace/block-markdown",
"private": true,
"version": "0.0.0",
"scripts": {
"test": "vitest"
},
"devDependencies": {
"vitest": "^0.15.1"
},
"dependencies": {
"rehype-stringify": "^9.0.3",
"remark-parse": "^10.0.1",
"remark-rehype": "^10.1.0",
"unified": "^10.1.2"
}
}