docs: improve community plugins

This commit is contained in:
lowlighter
2022-11-21 18:23:53 -05:00
parent d6550bedb2
commit 7c342bf915
3 changed files with 31 additions and 12 deletions

View File

@@ -36,13 +36,31 @@ Generate metrics that can be embedded everywhere, including your GitHub profile
<% } %> <%- readme.demo.replace(/<img src=/g, `<img alt="" width="400" src=`)?.split("\n")?.map((x, i) => i ? ` ${x}` : x)?.join("\n") %> <% } %> <%- readme.demo.replace(/<img src=/g, `<img alt="" width="400" src=`)?.split("\n")?.map((x, i) => i ? ` ${x}` : x)?.join("\n") %>
<% if (cell === "odd") { <% if (cell === "odd") {
-%> </tr> -%> </tr>
<% }}} -%> <% }}}} {
let cell = 0
const elements = Object.entries(plugins).filter(([key, value]) => (value.category === "community")&&(!value.deprecation))
if (elements.length%2)
elements.push(["", {readme:{demo:`<td align="center"><img width="900" height="1" alt=""></td>`}}])
-%>
<tr> <tr>
<th colspan="2" align="center"> <th colspan="2" align="center">
<a href="/source/plugins/community/README.md">🎲 See also community plugins</a> <a href="/source/plugins/community/README.md">🎲 See also community plugins</a>
</th> </th>
</tr> </tr>
<%
for (let i = 0; i < elements.length; i+=2) {
const cells = [["even", elements[i]], ["odd", elements[i+1]]]
for (const [cell, [plugin, {name, readme, authors}]] of cells) {
if (cell === "even") {
-%>
<tr>
<% } %> <th><% if (plugin) { %><a href="source/plugins/community/<%= plugin %>/README.md"><%= name -%></a><br><sup>by <%- authors.map(author => `<a href="https://github.com/${author}">@${author}</a>`).join(" ") %></sup>
<%- readme.demo.replace(/<td.*?>([\s\S]+?)<\/td>/, `<details><summary>Render example</summary>$1</details>`).replace(/<img src=/g, `<img alt="" width="400" src=`)?.split("\n")?.map((x, i) => i ? ` ${x}` : x)?.join("\n") %>
<% } %> <% } %>
</th>
<% if (cell === "odd") {
-%> </tr>
<% }}}} %>
<% { <% {
let cell = 0 let cell = 0
const elements = Object.entries(templates).filter(([key, value]) => (value)&&(!["community"].includes(key))) const elements = Object.entries(templates).filter(([key, value]) => (value)&&(!["community"].includes(key)))
@@ -94,6 +112,11 @@ Generate metrics that can be embedded everywhere, including your GitHub profile
<img src="/.github/readme/imgs/features_insights.gif" width="360"> <img src="/.github/readme/imgs/features_insights.gif" width="360">
</td> </td>
</tr> </tr>
<tr>
<td align="center" colspan="2">
Test latest features and patches on <code><a href="https://beta-metrics.lecoq.io">🧪 Metrics beta</a></code>!
</td>
</tr>
<tr> <tr>
<td align="center" colspan="2"> <td align="center" colspan="2">
<b>Power user?</b><br> <b>Power user?</b><br>

View File

@@ -9,9 +9,9 @@
elements.push(["", {readme:{demo:`<td align="center"><img width="900" height="1" alt=""></td>`}}]) elements.push(["", {readme:{demo:`<td align="center"><img width="900" height="1" alt=""></td>`}}])
for (let i = 0; i < elements.length; i+=2) { for (let i = 0; i < elements.length; i+=2) {
const cells = [["even", elements[i]], ["odd", elements[i+1]]] const cells = [["even", elements[i]], ["odd", elements[i+1]]]
for (const [cell, [plugin, {name, readme}]] of cells) { for (const [cell, [plugin, {name, readme, authors}]] of cells) {
if (cell === "even") { %> <tr><% } %> if (cell === "even") { %> <tr><% } %>
<th><% if (plugin) { %><a href="/source/plugins/community/<%= plugin %>/README.md"><%= name -%></a><% } %></th><% <th><% if (plugin) { %><a href="/source/plugins/community/<%= plugin %>/README.md"><%= name -%></a><br><sup>by <%- authors.map(author => `<a href="https://github.com/${author}">@${author}</a>`).join(" ") %></sup><% } %></th><%
if (cell === "odd") { %> if (cell === "odd") { %>
</tr> </tr>
<% }} <% }}

View File

@@ -1,15 +1,11 @@
<table> <table>
<tr><th colspan="2"><h3>📕 Community templates</h3></th></tr> <tr><th colspan="2"><h3>📕 Community templates</h3></th></tr>
<tr><td colspan="2" align="center">A template capable of rendering markdown from a given template file.</td></tr> <tr><td colspan="2" align="center">
<tr>
<td colspan="2" align="center">
<img src="https://github.com/lowlighter/metrics/blob/examples/metrics.markdown.png" alt=""></img>
<img width="900" height="1" alt="">
</td>
</tr>
</table>
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). 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).
</td></tr>
</table>
## 📮 Using community templates ## 📮 Using community templates