Skip to content

Commit 054f87e

Browse files
committed
load prism
1 parent 8c653d4 commit 054f87e

File tree

5 files changed

+8
-11
lines changed

5 files changed

+8
-11
lines changed

README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,3 @@ foo `'ts const x: number = 123;` bar
99
aaa `'json ["welcome!"]` bbb
1010
asd `'md *i* **b** _u_ ~~s~~'` jkl
1111
```
12-
13-
#### Note
14-
Highlighting uses the builtin Prism.
15-
I don't know how to import it yet, so it'll work only after you've opened a page with a code block that Obsidian highlights itself

manifest.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"id": "inline-code-highlight",
33
"name": "InlineCodeHighlight",
4-
"version": "1.0.0",
4+
"version": "1.0.1",
55
"minAppVersion": "0.15.0",
66
"description": "Highlight inline `'md **code**` blocks as well as you do the ```md **big**``` ones",
77
"author": "Dimava",
88
"authorUrl": "https://github.com/dimava",
99
"isDesktopOnly": false
10-
}
10+
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "inline-code-highlight",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"description": "Highlight inline `'md **code**` blocks as well as you do the ```md **big**``` ones",
55
"main": "main.js",
66
"scripts": {

src/main.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Plugin } from "obsidian";
1+
import { Plugin, loadPrism } from "obsidian";
22

33
export default class InlineCodeHighlight extends Plugin {
44
async onload() {
@@ -16,7 +16,7 @@ export default class InlineCodeHighlight extends Plugin {
1616

1717
cb.classList.add(`lang-${lang}`, 'plugin-inline-code-highlight');
1818
cb.innerText = code;
19-
window.Prism?.highlightElement(cb);
19+
loadPrism().then((Prism: typeof window.Prism) => Prism.highlightElement(cb))
2020
}
2121
});
2222
}

versions.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
{
2-
"1.0.0": "0.15.0"
3-
}
2+
"1.0.0": "0.15.0",
3+
"1.0.1": "0.15.0"
4+
}

0 commit comments

Comments
 (0)