feat: dynamic ish terminal preview
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
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">/);
|
||||
});
|
||||
Reference in New Issue
Block a user