16 lines
639 B
JavaScript
16 lines
639 B
JavaScript
import test from "node:test";
|
|
import assert from "node:assert/strict";
|
|
import { extractTerminalPreview, removeTerminalPreview } from "../src/_filters/index.js";
|
|
|
|
test("Terminal previews: stop before the first subsequent Markdown heading at any level", () => {
|
|
const renderedPost = `
|
|
<h1 id="terminal-preview">Terminal preview</h1>
|
|
<p>Plain Markdown preview text is supported.</p>
|
|
<h2 id="findings">Findings</h2>
|
|
<p>The article begins here.</p>
|
|
`;
|
|
|
|
assert.match(extractTerminalPreview(renderedPost), /Plain Markdown preview text/);
|
|
assert.match(removeTerminalPreview(renderedPost), /^\n <h2 id="findings">/);
|
|
});
|