Update markdown documentation
This commit is contained in:
@@ -262,12 +262,14 @@ export const svg = {
|
||||
page.on("console", ({_text:text}) => console.debug(`metrics/svg/pdf > puppeteer > ${text}`))
|
||||
await page.setContent(`<main class="markdown-body">${rendered}</main>`, {waitUntil:["load", "domcontentloaded", "networkidle2"]})
|
||||
console.debug("metrics/svg/pdf > loaded svg successfully")
|
||||
const margins = (Array.isArray(paddings) ? paddings : paddings.split(",")).join(" ")
|
||||
console.log(`metrics/svg/pdf > margins set to ${margins}`)
|
||||
await page.addStyleTag({
|
||||
content:`
|
||||
main { margin: ${(Array.isArray(paddings) ? paddings : paddings.split(",")).join(" ")}; }
|
||||
main svg { height: 1em; width: 1em; }
|
||||
${await fs.readFile(paths.join(__module(import.meta.url), "../../../node_modules", "@primer/css/dist/markdown.css")).catch(_ => "")}${style}
|
||||
`,
|
||||
main { margin: ${margins}; }
|
||||
main svg { height: 1em; width: 1em; }
|
||||
${await fs.readFile(paths.join(__module(import.meta.url), "../../../node_modules", "@primer/css/dist/markdown.css")).catch(_ => "")}${style}
|
||||
`,
|
||||
})
|
||||
rendered = await page.pdf()
|
||||
//Result
|
||||
|
||||
@@ -50,9 +50,16 @@ ___
|
||||
|
||||
To include SVGs metrics images without creating additional jobs, use the `embed` function:
|
||||
|
||||
<%- await embed(`example-isocalendar`, {isocalendar:true, isocalendar_duration:"full-year"}) %>
|
||||
<%- await embed(`example-isocalendar`, {isocalendar:true, isocalendar_duration:"full-year", config_display:"large"}) %>
|
||||
|
||||
<%- await embed(`example-languages-pdf`, {languages:true, languages_details:"percentage, bytes-size", config_display:"large"}) %>
|
||||
|
||||
It takes two arguments:
|
||||
- An unique identifier which will be used as filename withing `markdown_cache` folder
|
||||
- Configuration options (see [action.yml](https://github.com/lowlighter/metrics/blob/master/action.yml))
|
||||
- Tokens options are automatically passed down from your workflow job, do not pass them again
|
||||
|
||||
Note that unlike regular workflow jobs, `embed` function does not have `base` plugin enabled by default.
|
||||
If you wish to diplay parts of it, they must be explicitely enabled:
|
||||
|
||||
<%- await embed(`example-base-pdf`, {base:"activity, community, repositories"}) %>
|
||||
|
||||
Reference in New Issue
Block a user