Skip to content

Commit

Permalink
load prism
Browse files Browse the repository at this point in the history
  • Loading branch information
Dimava committed Aug 6, 2023
1 parent 8c653d4 commit 054f87e
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 11 deletions.
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,3 @@ foo `'ts const x: number = 123;` bar
aaa `'json ["welcome!"]` bbb
asd `'md *i* **b** _u_ ~~s~~'` jkl
```

#### Note
Highlighting uses the builtin Prism.
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
4 changes: 2 additions & 2 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"id": "inline-code-highlight",
"name": "InlineCodeHighlight",
"version": "1.0.0",
"version": "1.0.1",
"minAppVersion": "0.15.0",
"description": "Highlight inline `'md **code**` blocks as well as you do the ```md **big**``` ones",
"author": "Dimava",
"authorUrl": "https://github.com/dimava",
"isDesktopOnly": false
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "inline-code-highlight",
"version": "1.0.0",
"version": "1.0.1",
"description": "Highlight inline `'md **code**` blocks as well as you do the ```md **big**``` ones",
"main": "main.js",
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Plugin } from "obsidian";
import { Plugin, loadPrism } from "obsidian";

export default class InlineCodeHighlight extends Plugin {
async onload() {
Expand All @@ -16,7 +16,7 @@ export default class InlineCodeHighlight extends Plugin {

cb.classList.add(`lang-${lang}`, 'plugin-inline-code-highlight');
cb.innerText = code;
window.Prism?.highlightElement(cb);
loadPrism().then((Prism: typeof window.Prism) => Prism.highlightElement(cb))
}
});
}
Expand Down
5 changes: 3 additions & 2 deletions versions.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"1.0.0": "0.15.0"
}
"1.0.0": "0.15.0",
"1.0.1": "0.15.0"
}

0 comments on commit 054f87e

Please sign in to comment.