mirror of
https://github.com/outline/outline.git
synced 2026-12-05 10:45:07 +03:00
chore(deps): bump katex from 0.18.2 to 0.19.1 (#14875)
* chore(deps): bump katex from 0.18.2 to 0.19.1 Bumps [katex](https://github.com/KaTeX/KaTeX) from 0.18.2 to 0.19.1. - [Release notes](https://github.com/KaTeX/KaTeX/releases) - [Changelog](https://github.com/KaTeX/KaTeX/blob/main/CHANGELOG.md) - [Commits](https://github.com/KaTeX/KaTeX/compare/v0.18.2...v0.19.1) --- updated-dependencies: - dependency-name: katex dependency-version: 0.19.1 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * Update CSS --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Tom Moor <tom@getoutline.com>
This commit is contained in:
1 parent
30da7e7ae6
commit
731d681c26
5 files changed
+60
-10
No files matched your search
@@ -0,0 +1,42 @@
|
||||
// Download a document as HTML through "Document options" → Export → HTML,
|
||||
// then open the downloaded file and screenshot it.
|
||||
// Args: doc= (path such as /doc/<slug>, required), expect= (text in the file).
|
||||
import fs from "node:fs";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
|
||||
export default async ({ page, context, click, step, args, log }) => {
|
||||
if (!args.doc) {
|
||||
throw new Error("doc= is required");
|
||||
}
|
||||
await page.goto(args.doc);
|
||||
await page.waitForLoadState("networkidle");
|
||||
await click(page.getByRole("button", { name: "Document options" }));
|
||||
await click(page.getByRole("menuitem", { name: "Export" }));
|
||||
const htmlItem = page.getByRole("menu", { name: "Export" }).getByRole("menuitem", { name: /^HTML/ });
|
||||
await htmlItem.waitFor();
|
||||
await step("export-menu");
|
||||
const [download] = await Promise.all([
|
||||
page.waitForEvent("download"),
|
||||
// A pointer move to the submenu crosses "Copy" and closes it, so use the keyboard.
|
||||
htmlItem.focus().then(() => page.keyboard.press("Enter")),
|
||||
]);
|
||||
const file = path.join(fs.mkdtempSync(path.join(os.tmpdir(), "outline-export-")), download.suggestedFilename());
|
||||
await download.saveAs(file);
|
||||
const html = fs.readFileSync(file, "utf8");
|
||||
const stylesheet = html.match(/https:\/\/cdn\.jsdelivr\.net\/npm\/katex@[^"]+/)?.[0];
|
||||
log("file:", file, "stylesheet:", stylesheet);
|
||||
if (args.expect && !html.includes(args.expect)) {
|
||||
throw new Error(`downloaded HTML does not include ${JSON.stringify(args.expect)}`);
|
||||
}
|
||||
|
||||
const view = await context.newPage();
|
||||
await view.goto(`file://${file}`, { waitUntil: "networkidle" });
|
||||
await view.evaluate(() => document.fonts.ready);
|
||||
const errors = await view.locator(".katex-error").count();
|
||||
if (errors !== 0) {
|
||||
throw new Error(`${errors} KaTeX error nodes in export`);
|
||||
}
|
||||
await step("downloaded-html", view);
|
||||
return { file, stylesheet };
|
||||
};
|
||||
+1
-1
@@ -145,7 +145,7 @@
|
||||
"js.foresight": "^4.2.1",
|
||||
"jsdom": "^30.1.3",
|
||||
"jsonwebtoken": "^9.0.3",
|
||||
"katex": "^0.18.2",
|
||||
"katex": "^0.19.1",
|
||||
"kbar": "^1.0.0",
|
||||
"koa": "^3.3.0",
|
||||
"koa-body": "^8.0.1",
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { version as katexVersion } from "katex";
|
||||
import Revision from "@server/models/Revision";
|
||||
import { buildCollection, buildDocument } from "@server/test/factories";
|
||||
import { ChangesetHelper } from "@shared/editor/lib/ChangesetHelper";
|
||||
@@ -254,7 +255,7 @@ describe("DocumentHelper", () => {
|
||||
});
|
||||
const result = await DocumentHelper.toHTML(document);
|
||||
expect(result).toContain('class="katex"');
|
||||
expect(result).toContain("katex.min.css");
|
||||
expect(result).toContain(`katex@${katexVersion}/dist/katex.min.css`);
|
||||
});
|
||||
|
||||
it("should not include the KaTeX stylesheet without math", async () => {
|
||||
|
||||
@@ -4,6 +4,7 @@ import emojiRegex from "emoji-regex";
|
||||
import type { JSDOM } from "jsdom";
|
||||
import { chunk } from "es-toolkit/compat";
|
||||
import ukkonen from "ukkonen";
|
||||
import { version as katexVersion } from "katex";
|
||||
import { EditorState, type Plugin } from "prosemirror-state";
|
||||
import {
|
||||
DecorationSet,
|
||||
@@ -114,8 +115,7 @@ class NoopResizeObserver implements ResizeObserver {
|
||||
|
||||
// KaTeX renders math server-side during HTML export, but relies on this
|
||||
// stylesheet (loaded dynamically in the app) to position glyphs correctly.
|
||||
const katexStylesheetUrl =
|
||||
"https://cdn.jsdelivr.net/npm/katex@0.16.45/dist/katex.min.css";
|
||||
const katexStylesheetUrl = `https://cdn.jsdelivr.net/npm/katex@${katexVersion}/dist/katex.min.css`;
|
||||
|
||||
function isDecorationSource(value: unknown): value is DecorationSource {
|
||||
if (typeof value !== "object" || value === null) {
|
||||
|
||||
@@ -8867,6 +8867,13 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"commander@npm:^15.0.0":
|
||||
version: 15.1.0
|
||||
resolution: "commander@npm:15.1.0"
|
||||
checksum: 10c0/dd1013291d3e8779c726313616fa23174abc962182d0894ac73017c55d8b1ffe4a72401d91a1173974050536576896dc5279db07d37f929dbad469a16a12c54e
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"commander@npm:^2.20.0":
|
||||
version: 2.20.3
|
||||
resolution: "commander@npm:2.20.3"
|
||||
@@ -12585,14 +12592,14 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"katex@npm:^0.18.2":
|
||||
version: 0.18.2
|
||||
resolution: "katex@npm:0.18.2"
|
||||
"katex@npm:^0.19.1":
|
||||
version: 0.19.1
|
||||
resolution: "katex@npm:0.19.1"
|
||||
dependencies:
|
||||
commander: "npm:^8.3.0"
|
||||
commander: "npm:^15.0.0"
|
||||
bin:
|
||||
katex: cli.js
|
||||
checksum: 10c0/05f0eadc718cbf18d805089cfe7d930f15199b2781087f2055b25f93b0adaad5cfa7c50311366ced324e85f382edae7ed20ba09819ff8eab62b96bba5fe97029
|
||||
checksum: 10c0/20ceeefe75b852acfb1739aa1fe64322acee332cdd7ccefb6e952285c27201ccfb92c65afb38d555d53a41756fba77b7cd60462f8cfce7323a3902ef2e57ad91
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -14489,7 +14496,7 @@ __metadata:
|
||||
js.foresight: "npm:^4.2.1"
|
||||
jsdom: "npm:^30.1.3"
|
||||
jsonwebtoken: "npm:^9.0.3"
|
||||
katex: "npm:^0.18.2"
|
||||
katex: "npm:^0.19.1"
|
||||
kbar: "npm:^1.0.0"
|
||||
koa: "npm:^3.3.0"
|
||||
koa-body: "npm:^8.0.1"
|
||||
|
||||
Reference in new issue
Block a user