Skip to content

Commit

Permalink
add Juice theme shortcodes
Browse files Browse the repository at this point in the history
  • Loading branch information
hatappo committed Nov 19, 2021
1 parent ed7e62d commit 694cdee
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 1 deletion.
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
1. Chart
2. Galleria
3. Katex
4. mapbox
4. MapBox
5. Mermaid
6. Vimeo
7. YouTube
Expand All @@ -29,6 +29,17 @@
- [HTML](https://github.com/RatanShreshtha/DeepThought/tree/main/templates/shortcodes)


### [Theme - Juice](https://github.com/huhu/juice)

1. Issue

<img src="docs/screenshot-Juice-shortcodes-in-blogui.png" width="240px"> <img src="docs/screenshot-Juice-shortcodes-in-netlifycms.png" width="240px">


- [Docs](https://github.com/RatanShreshtha/DeepThought/blob/main/content/docs/extended-shortcodes/index.md)
- [HTML](https://github.com/RatanShreshtha/DeepThought/tree/main/templates/shortcodes)


## Usage

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.
Expand Down
Binary file added docs/screenshot-Juice-shortcodes-in-blogui.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions src/juice/issue.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
CMS.registerEditorComponent({
id: "issue",
label: "GitHub Issue",
fields: [
{
name: "id",
label: "the issue id (mandatory)",
widget: "number"
},
],
pattern: /{{ issue\(id=([1-9][0-9]*)\) }}/,
fromBlock: function(match) {
return {
id: match[1],
};
},
toBlock: function(obj) {
const id = obj.id || '';
return `{{ issue(id=${id}) }}`;
},
toPreview: function(obj) {
const id = obj.id || '';
return `<a href="">Github Issue #${id}</a>`;
},
});

0 comments on commit 694cdee

Please sign in to comment.