build: markdown description for metadata.yml [skip ci]

This commit is contained in:
lowlighter
2022-01-15 18:02:39 -05:00
parent 1d5a8efea7
commit 318d712541

View File

@@ -4,6 +4,7 @@ import yaml from "js-yaml"
import path from "path" import path from "path"
import url from "url" import url from "url"
import fetch from "node-fetch" import fetch from "node-fetch"
import {marked} from "marked"
//Defined categories //Defined categories
const categories = ["core", "github", "social", "community"] const categories = ["core", "github", "social", "community"]
@@ -359,7 +360,7 @@ metadata.plugin = async function({__plugins, __templates, name, logger}) {
cell.push(`<b>allowed values:</b><ul>${o.values.map(value => `<li>${value}</li>`).join("")}</ul>`) cell.push(`<b>allowed values:</b><ul>${o.values.map(value => `<li>${value}</li>`).join("")}</ul>`)
return ` <tr> return ` <tr>
<td nowrap="nowrap"><code>${option}</code></td> <td nowrap="nowrap"><code>${option}</code></td>
<td rowspan="2">${description}<img width="900" height="1" alt=""></td> <td rowspan="2">${marked.parse(description, {silent:true})}<img width="900" height="1" alt=""></td>
</tr> </tr>
<tr> <tr>
<td nowrap="nowrap">${cell.join("\n")}</td> <td nowrap="nowrap">${cell.join("\n")}</td>
@@ -379,6 +380,7 @@ metadata.plugin = async function({__plugins, __templates, name, logger}) {
return meta return meta
} }
catch (error) { catch (error) {
console.warn(error)
logger(`metrics/metadata > failed to load plugin ${name}: ${error}`) logger(`metrics/metadata > failed to load plugin ${name}: ${error}`)
return null return null
} }