Skip to content

Commit 5914046

Browse files
committed
Fixes gist won't render when the username contains character -
Resolve #7.
1 parent 6b54817 commit 5914046

File tree

12 files changed

+287
-2
lines changed

12 files changed

+287
-2
lines changed

.tool-versions

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
nodejs 16.5.0
1+
nodejs 19.8.1

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## master
44

5+
- Fixes gist won't render when the username contains character `-`. (Fixes #7)
6+
57
## 0.9.0
68

79
⚠️

src/gist_processor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class GistProcessor {
5353
// private
5454

5555
private async _processGist(el: HTMLElement, gistString: string) {
56-
const pattern = /(?<protocol>https?:\/\/)?(?<host>gist\.github\.com\/)?((?<username>\w+)\/)?(?<gistID>\w+)(\#(?<filename>.+))?/
56+
const pattern = /(?<protocol>https?:\/\/)?(?<host>gist\.github\.com\/)?((?<username>[\w-]+)\/)?(?<gistID>\w+)(\#(?<filename>.+))?/
5757

5858
const matchResult = gistString.match(pattern).groups
5959

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"accentColor": ""
3+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[
2+
"obsidian-gist"
3+
]
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"file-explorer": true,
3+
"global-search": true,
4+
"switcher": true,
5+
"graph": true,
6+
"backlink": true,
7+
"canvas": true,
8+
"outgoing-link": true,
9+
"tag-pane": true,
10+
"properties": true,
11+
"page-preview": true,
12+
"daily-notes": true,
13+
"templates": true,
14+
"note-composer": true,
15+
"command-palette": true,
16+
"slash-command": false,
17+
"editor-status": true,
18+
"bookmarks": true,
19+
"markdown-importer": false,
20+
"zk-prefixer": false,
21+
"random-note": false,
22+
"outline": true,
23+
"word-count": true,
24+
"slides": false,
25+
"audio-recorder": false,
26+
"workspaces": false,
27+
"file-recovery": true,
28+
"publish": false,
29+
"sync": false
30+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
[
2+
"file-explorer",
3+
"global-search",
4+
"switcher",
5+
"graph",
6+
"backlink",
7+
"canvas",
8+
"outgoing-link",
9+
"tag-pane",
10+
"properties",
11+
"page-preview",
12+
"daily-notes",
13+
"templates",
14+
"note-composer",
15+
"command-palette",
16+
"editor-status",
17+
"bookmarks",
18+
"outline",
19+
"word-count",
20+
"file-recovery"
21+
]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../

0 commit comments

Comments
 (0)