Align Taro pages with Next hub/nav/book/community/VIP, pack the single-index Xiaohongshu portal with host-chrome safe areas, and refresh shared book content plus portal README constraints. Co-authored-by: Cursor <cursoragent@cursor.com>
52 lines
1.2 KiB
JavaScript
52 lines
1.2 KiB
JavaScript
const fs = require("fs");
|
|
const vm = require("vm");
|
|
const s = fs.readFileSync(__dirname + "/../release/app.js", "utf8");
|
|
const w = {
|
|
document: {
|
|
readyState: "complete",
|
|
getElementById: () => null,
|
|
addEventListener: () => {},
|
|
documentElement: { setAttribute() {}, style: { setProperty() {} } },
|
|
body: {},
|
|
},
|
|
localStorage: { getItem: () => null, setItem() {} },
|
|
scrollTo() {},
|
|
};
|
|
w.window = w;
|
|
vm.createContext(w);
|
|
vm.runInContext(s, w);
|
|
if (!w.MarkdownLite) {
|
|
console.error("FAIL no MarkdownLite");
|
|
process.exit(1);
|
|
}
|
|
const md = [
|
|
"# 标题",
|
|
"",
|
|
"**粗体** 和 *斜体*",
|
|
"",
|
|
"- 列表A",
|
|
"- 列表B",
|
|
"",
|
|
"> 引用一行",
|
|
"",
|
|
"```",
|
|
"code here",
|
|
"```",
|
|
"",
|
|
"正文段落。",
|
|
].join("\n");
|
|
const html = w.MarkdownLite.markdownToHtml(md, { theme: "dark", dropCap: true });
|
|
const checks = {
|
|
strong: html.indexOf("<strong") >= 0,
|
|
list: html.indexOf("md-list") >= 0,
|
|
quote: html.indexOf("md-quote") >= 0,
|
|
pre: html.indexOf("md-pre") >= 0,
|
|
p: html.indexOf("<p") >= 0,
|
|
};
|
|
console.log(JSON.stringify(checks, null, 2));
|
|
console.log(html.slice(0, 400));
|
|
if (!checks.strong || !checks.list || !checks.quote || !checks.pre) {
|
|
process.exit(1);
|
|
}
|
|
console.log("md smoke ok");
|