Back to Metrics

README

source/plugins/community/screenshot/README.md

3.344.7 KB
Original Source
<!--header--> <table> <tr><td colspan="2"><a href="/README.md#-plugins">← Back to plugins index</a></td></tr> <tr><th colspan="2"><h3>šŸ“ø Website screenshot</h3></th></tr> <tr><td colspan="2" align="center"><p>This plugin displays a screenshot from any website.</p> <p>It can either show the full page or a portion restricted by a <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors">CSS selector</a>.</p> </td></tr> <tr><th>Authors</th><td><a href="https://github.com/lowlighter">@lowlighter</a></td></tr> <tr> <th rowspan="3">Supported features <sub><a href="metadata.yml">→ Full specification</a></sub></th> <td><a href="/source/templates/classic/README.md"><code>šŸ“— Classic template</code></a> <a href="/source/templates/repository/README.md"><code>šŸ“˜ Repository template</code></a> <a href="/source/templates/terminal/README.md"><code>šŸ“™ Terminal template</code></a></td> </tr> <tr> <td><code>šŸ‘¤ Users</code> <code>šŸ‘„ Organizations</code> <code>šŸ““ Repositories</code></td> </tr> <tr> <td><i>No tokens are required for this plugin</i></td> </tr> <tr> <td colspan="2" align="center"> </img>
</td>
</tr> </table> <!--/header-->

āž”ļø Available options

<!--options--> <table> <tr> <td align="center" nowrap="nowrap">Option</i></td><td align="center" nowrap="nowrap">Description</td> </tr> <tr> <td nowrap="nowrap"><h4><code>plugin_screenshot</code></h4></td> <td rowspan="2"><p>Enable screenshot plugin</p> </td> </tr> <tr> <td nowrap="nowrap">🌐 Web instances must configure <code>settings.json</code>: <ul> <li><i>metrics.run.puppeteer.scrapping</i></li> </ul> <b>type:</b> <code>boolean</code>

<b>default:</b> no

</td> </tr> <tr> <td nowrap="nowrap"><h4><code>plugin_screenshot_title</code></h4></td> <td rowspan="2"><p>Title caption</p> </td> </tr> <tr> <td nowrap="nowrap"><b>type:</b> <code>string</code>

<b>default:</b> Screenshot

</td> </tr> <tr> <td nowrap="nowrap"><h4><code>plugin_screenshot_url</code></h4></td> <td rowspan="2"><p>Website URL</p> </td> </tr> <tr> <td nowrap="nowrap"><b>type:</b> <code>string</code> </td> </tr> <tr> <td nowrap="nowrap"><h4><code>plugin_screenshot_selector</code></h4></td> <td rowspan="2"><p>CSS Selector</p> </td> </tr> <tr> <td nowrap="nowrap"><b>type:</b> <code>string</code>

<b>default:</b> body

</td> </tr> <tr> <td nowrap="nowrap"><h4><code>plugin_screenshot_mode</code></h4></td> <td rowspan="2"><p>Output mode</p> <ul> <li><code>image</code>: screenshot of selected element</li> <li><code>text</code>: keep <a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/innerText"><code>innerText</code></a> of selected element<ul> <li><em>āš ļø Any CSS style applied to text such as font size, weight or color will be removed</em></li> </ul> </li> </ul> </td> </tr> <tr> <td nowrap="nowrap"><b>type:</b> <code>string</code>

<b>default:</b> image

<b>allowed values:</b><ul><li>image</li><li>text</li></ul></td>

</tr> <tr> <td nowrap="nowrap"><h4><code>plugin_screenshot_viewport</code></h4></td> <td rowspan="2"><p>Viewport options</p> </td> </tr> <tr> <td nowrap="nowrap"><b>type:</b> <code>json</code>

<b>default:</b> <details><summary>→ Click to expand</summary><pre language="json"><code>{ "width": 1280, "height": 1280 } </code></pre></details>

</td> </tr> <tr> <td nowrap="nowrap"><h4><code>plugin_screenshot_wait</code></h4></td> <td rowspan="2"><p>Wait time before taking screenshot (ms)</p> </td> </tr> <tr> <td nowrap="nowrap"><b>type:</b> <code>number</code> <i>(0 ≤ š‘„)</i>

<b>default:</b> 0

</td> </tr> <tr> <td nowrap="nowrap"><h4><code>plugin_screenshot_background</code></h4></td> <td rowspan="2"><p>Background</p> </td> </tr> <tr> <td nowrap="nowrap"><b>type:</b> <code>boolean</code>

<b>default:</b> yes

</td> </tr> </table> <!--/options-->

ā„¹ļø Examples workflows

<!--examples-->
yaml
name: XKCD of the day
uses: lowlighter/metrics@latest
with:
  filename: metrics.plugin.screenshot.svg
  token: NOT_NEEDED
  base: ""
  plugin_screenshot: yes
  plugin_screenshot_title: XKCD of the day
  plugin_screenshot_url: https://xkcd.com
  plugin_screenshot_selector: "#comic img"

<!--/examples-->