Skip to content

Commit 7228fc3

Browse files
committed
docs(templates/community): rewrite documentation
1 parent 2d6c9e1 commit 7228fc3

File tree

3 files changed

+68
-17
lines changed

3 files changed

+68
-17
lines changed
Lines changed: 52 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,62 @@
1-
### 📕 Community templates
1+
<table>
2+
<tr><th colspan="2"><h3>📕 Community templates</h3></th></tr>
3+
<tr><td colspan="2" align="center">A template capable of rendering markdown from a given template file.</td></tr>
4+
<tr>
5+
<td colspan="2" align="center">
6+
<img src="https://github.com/lowlighter/lowlighter/blob/master/metrics.markdown.png" alt=""></img>
7+
<img width="900" height="1" alt="">
8+
</td>
9+
</tr>
10+
</table>
211

3-
It is possible to use official releases with templates from forked repositories (whether you own them or not).
12+
___
413

5-
Use `setup_community_templates` option to specify additional external sources using following format: `user/repo@branch:template`.
6-
Templates added this way will be downloaded through git and can be used by prefixing their name with an `@`.
14+
Community templates are a way to use official releases of [lowlighter/metrics](https://github.com/lowlighter/metrics) while using templates from external repositories (owned or not).
715

8-
By default, community templates use `template.mjs` from official `classic` template instead of their own, to prevent executing malicious code and avoid token leaks.
16+
## 📮 Using community templates
917

10-
If you trust it, append `+trust` after their name.
18+
Use `setup_community_templates` option to specify additional external sources using following format:
19+
```
20+
user/repo@branch:template
21+
```
22+
23+
These templates will be downloaded through git and will be usable by prefixing their name with an `@`.
24+
25+
*Example: using `my-theme` template by downloading it from `user/repo`*
26+
```yml
27+
- uses: lowlighter/metrics@latest
28+
with:
29+
template: "@my-theme"
30+
setup_community_templates: "user/repo@main:my-theme"
31+
```
32+
33+
For security reasons, community templates will use the `classic` template `template.mjs` instead of their own.
34+
If you trust a community template, append `+trust` to it.
1135

12-
```yaml
36+
*Example: using and trusting `my-theme` template by downloading it from `user/repo`*
37+
```yml
1338
- uses: lowlighter/metrics@latest
1439
with:
15-
# ... other options
16-
template: "@super-metrics"
17-
# Download "super-metrics" and "trusted-metrics" templates from "octocat/metrics@master"
18-
# "@trusted-metrics" template can execute remote JavaScript code
19-
setup_community_templates: octocat/metrics@master:super-metrics, octocat/metrics@master:trusted-metrics+trust
40+
template: "@my-theme"
41+
setup_community_templates: "user/repo@main:my-theme+trust"
2042
```
2143

22-
To create a new community template, fork this repository and create a new folder in `/source/templates` with same structure as current templates.
23-
Then, it's just as simple as HTML and CSS with a bit of JavaScript!
44+
> ⚠️ Note that it basically allow remote code execution and the template may have access to **sensitive data** along with **tokens**! Use this feature only from a trusted source. Remember that its content may also change at any time...
45+
46+
## 📪 Creating community templates
47+
48+
To create a new template, start a new repository and create a new folder in `/source/templates` with the same file structure as in [lowlighter/metrics](https://github.com/lowlighter/metrics) templates:
49+
50+
* `/source/templates`
51+
* `{template-name}`
52+
* `README.md`,
53+
* `metadata.yml`,
54+
* `image.svg`
55+
* `partials/`
56+
* `_.json`
57+
* `*.ejs`
58+
59+
Then use HTML, CSS, and [EJS](https://github.com/mde/ejs) to create something awesome!
60+
Do not hesitate to share it on [GitHub discussions](https://github.com/lowlighter/metrics/discussions)!
2461

25-
If you made something awesome, please share it here!
62+
For more information, see [contribution guide](/CONTRIBUTING.md).
Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
1-
- name: Example
1+
- name: Using a community template
22
uses: lowlighter/metrics@latest
33
with:
44
token: ${{ secrets.METRICS_TOKEN }}
55
template: "@classic"
66
setup_community_templates: "lowlighter/metrics@master:classic"
77
test:
88
modes:
9-
- action
9+
- action
10+
11+
- name: Using a trusted community template
12+
uses: lowlighter/metrics@latest
13+
with:
14+
token: ${{ secrets.METRICS_TOKEN }}
15+
template: "@terminal"
16+
setup_community_templates: "lowlighter/metrics@master:terminal+trust"
17+
test:
18+
modes:
19+
- action
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
name: "📕 Community templates"
2+
description: |
3+
A template mimicking GitHub visual identity.
4+
This is also the default template.

0 commit comments

Comments
 (0)