Skip to content

Commit

Permalink
load prismjs from cdn
Browse files Browse the repository at this point in the history
  • Loading branch information
yujonglee committed Oct 26, 2024
1 parent 6a3691d commit 096e0ff
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 35 deletions.
2 changes: 1 addition & 1 deletion js/apps/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"vue": "^3.4.35"
},
"dependencies": {
"@getcanary/web": "^1.0.10",
"@getcanary/web": "^1.0.11",
"@mux/blurup": "^0.2.3",
"@mux/mux-player": "^3.0.0",
"@unocss/reset": "^0.63.3",
Expand Down
15 changes: 3 additions & 12 deletions js/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions js/packages/web/.changeset/healthy-squids-jog.md

This file was deleted.

5 changes: 0 additions & 5 deletions js/packages/web/.changeset/odd-windows-doubt.md

This file was deleted.

5 changes: 0 additions & 5 deletions js/packages/web/.changeset/quick-lies-beam.md

This file was deleted.

7 changes: 7 additions & 0 deletions js/packages/web/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @getcanary/web

## 1.0.11

### Patch Changes

- Reset input when modal closed.
- Load prismjs from cdn instead of bundling it.

## 1.0.10

### Patch Changes
Expand Down
5 changes: 2 additions & 3 deletions js/packages/web/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@getcanary/web",
"version": "1.0.10",
"version": "1.0.11",
"license": "MIT",
"type": "module",
"main": "dist/components/canary-root.js",
Expand Down Expand Up @@ -39,8 +39,7 @@
"best-effort-json-parser": "^1.1.2",
"lit": "^3.1.4",
"marked": "^14.0.0",
"picomatch": "^4.0.2",
"prismjs": "^1.29.0"
"picomatch": "^4.0.2"
},
"devDependencies": {
"@argos-ci/cli": "^2.4.3",
Expand Down
7 changes: 4 additions & 3 deletions js/packages/web/src/components/canary-markdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { themeContext } from "../contexts";
import { ThemeContext } from "../types";
import { global, codeBlockScrollbar } from "../styles";

import { highlightElement } from "prismjs";
import { marked, type Tokens } from "marked";

marked.use({
Expand Down Expand Up @@ -47,7 +46,7 @@ export class CanaryMarkdown extends LitElement {

return html`
<link rel="stylesheet" href=${stylePath} />
${this.languages.map((lang) =>
${["core", ...this.languages].map((lang) =>
this._script(
`https://unpkg.com/[email protected]/components/prism-${lang}.min.js`,
),
Expand Down Expand Up @@ -90,7 +89,9 @@ export class CanaryMarkdown extends LitElement {

private _highlight(el: HTMLElement) {
el.querySelectorAll("pre code").forEach((el) => {
highlightElement(el, false);
if (window.Prism) {
window.Prism.highlightElement(el, false);
}
});
}

Expand Down
2 changes: 1 addition & 1 deletion js/packages/web/src/stories/canary-markdown.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default {
style="width: 500px; padding: 12px; border: 1px solid black; border-radius: 8px;"
>
<canary-markdown
.languages=${["javascript", "python"]}
.languages=${["javascript", "python", "markup"]}
.content=${content}
></canary-markdown>
</div>
Expand Down

0 comments on commit 096e0ff

Please sign in to comment.