Introduce micromark-html-browser(.dev).js exporting micromark functions to render HTML from parsed/processed Markdown.

This commit is contained in:
David Anson 2023-05-27 18:03:20 -07:00
parent 1dd49791e0
commit 91e5a2f134
5 changed files with 43 additions and 2 deletions

2
.gitignore vendored
View file

@ -6,6 +6,8 @@ micromark/micromark.cjs
micromark/micromark.dev.cjs
micromark/micromark-browser.js
micromark/micromark-browser.dev.js
micromark/micromark-html-browser.js
micromark/micromark-html-browser.dev.js
node_modules
!test/node_modules
npm-debug.log

View file

@ -1,4 +1,6 @@
exports.mjs
exports-html.mjs
micromark.dev.cjs
micromark-browser.dev.js
micromark-html-browser.dev.js
webpack.config.js

View file

@ -0,0 +1,8 @@
// @ts-check
/* eslint-disable max-len, n/no-missing-import */
export { compile } from "micromark/lib/compile";
export { gfmAutolinkLiteralHtml } from "micromark-extension-gfm-autolink-literal";
export { gfmFootnoteHtml } from "micromark-extension-gfm-footnote";
export { gfmTableHtml } from "micromark-extension-gfm-table";

View file

@ -1,6 +1,6 @@
{
"name": "markdownlint-micromark",
"version": "0.1.3",
"version": "0.1.4",
"description": "A trivial package that re-exports some micromark functionality as a CommonJS module",
"type": "commonjs",
"exports": "./micromark.cjs",
@ -23,7 +23,7 @@
"micromark-extension-gfm-autolink-literal": "1.0.4",
"micromark-extension-gfm-footnote": "1.1.0",
"micromark-extension-gfm-table": "1.0.6",
"webpack": "5.82.1",
"webpack": "5.84.1",
"webpack-cli": "5.1.1"
}
}

View file

@ -2,6 +2,9 @@
"use strict";
const htmlEntry = "./exports-html.mjs";
const htmlName = "micromarkHtmlBrowser";
const base = {
"entry": "./exports.mjs",
"output": {
@ -73,5 +76,31 @@ module.exports = [
...web.output,
"filename": "micromark-browser.dev.js"
}
},
{
...web,
...production,
"entry": htmlEntry,
"output": {
...web.output,
"library": {
...web.output.library,
"name": htmlName
},
"filename": "micromark-html-browser.js"
}
},
{
...web,
...development,
"entry": htmlEntry,
"output": {
...web.output,
"library": {
...web.output.library,
"name": htmlName
},
"filename": "micromark-html-browser.dev.js"
}
}
];