#### âšī¸ Examples workflows ___ This template can be used to a *markdown template file* with data gathered by metrics. Since the resulting output is a markdown file, it is possible to do additional formatting such as creating hyperlinks and adding custom texts. ## đī¸ Templating syntax: The templating engine is [EJS](https://github.com/mde/ejs) and can be used to interpolate any data retrieved by metrics. * `<%=` and `%>` are used to display escaped output * `{{` and `}}` is also supported as syntaxic sugar * `<%-` and `%>` are used to display raw output * `<%` and `%>` are used to execute JavaScript, and can also contains control statements such as conditionals and loops *Example: basic templating* ```markdown I joined GitHub on `{{ f.date(REGISTRATION_DATE, {date:true}) }}`. I contributed to `{{ REPOSITORIES_CONTRIBUTED_TO }}` repositories and made `{{ COMMITS }}` commits. I joined GitHub on `20 Oct 2016`. I contributed to `37` repositories and made `5947` commits. ``` ## đŖ Available data Any data fetched by metrics and exposed formatting helpers can be used. It also means that to access plugins data they must be enabled and configured beforehand. *Example: enabling `plugin_activity` exposes `plugins.activity` data* ```yml - uses: lowlighter/metrics@latest with: template: markdown plugin_activity: yes ``` > đĄ To avoid failures while accessing data, use [optional chaining operator `?.`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Optional_chaining) or ensure that no errors where reported by a given plugin. > â ī¸ Although rare, data schemas may change in-between metrics version without any notice (these changes are not documented in release notes). It is advised to use a pinned version or a fork when using this template. A few properties are aliased in [/source/templates/markdown/template.mjs](/source/templates/markdown/template.mjs) for convenience. Use `config_output: json` to dump all available data for a given configuration. Power users can also directly read [metrics source code](https://github.com/lowlighter/metrics) to know what is exposed. For a quick overview, it is also possible to use [metrics.lecoq.io/{username}?config.output=json](https://metrics.lecoq.io). > đĄ Note however that [metrics.lecoq.io](https://metrics.lecoq.io) has a caching system which may prevent any new result. ## đ§Š Plugins with markdown version Several plugins have a markdown version which provides better usability, usually with hyperlinks and better text formatting. *Example: using `âī¸ posts` plugin markdown version* ```ejs <%- await include(`partials/posts.ejs`) %> ``` **[âī¸ Recent posts from dev.to](https://dev.to/lowlighter)**
|
Metrics v3.0, the ultimate tool to pimp your GitHub profile! |
|---|---|
|
Metrics is an extensive SVG images generator plugged with various APIs (GitHub, Twitter, Spotify, ......
Published on 4 Jan 2021 |