Skip to content

Commit 694cdee

Browse files
committed
add Juice theme shortcodes
1 parent ed7e62d commit 694cdee

File tree

4 files changed

+37
-1
lines changed

4 files changed

+37
-1
lines changed

README.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
1. Chart
1818
2. Galleria
1919
3. Katex
20-
4. mapbox
20+
4. MapBox
2121
5. Mermaid
2222
6. Vimeo
2323
7. YouTube
@@ -29,6 +29,17 @@
2929
- [HTML](https://github.com/RatanShreshtha/DeepThought/tree/main/templates/shortcodes)
3030

3131

32+
### [Theme - Juice](https://github.com/huhu/juice)
33+
34+
1. Issue
35+
36+
<img src="docs/screenshot-Juice-shortcodes-in-blogui.png" width="240px"> <img src="docs/screenshot-Juice-shortcodes-in-netlifycms.png" width="240px">
37+
38+
39+
- [Docs](https://github.com/RatanShreshtha/DeepThought/blob/main/content/docs/extended-shortcodes/index.md)
40+
- [HTML](https://github.com/RatanShreshtha/DeepThought/tree/main/templates/shortcodes)
41+
42+
3243
## Usage
3344

3445
1. Add or checkout [dist/zola-shortcodes-netlify-cms.built-in.js](/dist/zola-shortcodes-netlify-cms.built-in.js) to the `static` directory in your Zola project.
46.1 KB
Loading
Loading

src/juice/issue.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
CMS.registerEditorComponent({
2+
id: "issue",
3+
label: "GitHub Issue",
4+
fields: [
5+
{
6+
name: "id",
7+
label: "the issue id (mandatory)",
8+
widget: "number"
9+
},
10+
],
11+
pattern: /{{ issue\(id=([1-9][0-9]*)\) }}/,
12+
fromBlock: function(match) {
13+
return {
14+
id: match[1],
15+
};
16+
},
17+
toBlock: function(obj) {
18+
const id = obj.id || '';
19+
return `{{ issue(id=${id}) }}`;
20+
},
21+
toPreview: function(obj) {
22+
const id = obj.id || '';
23+
return `<a href="">Github Issue #${id}</a>`;
24+
},
25+
});

0 commit comments

Comments
 (0)