A Hugo theme component with caniuse shortcode.
来源:hugo-fixit/shortcode-caniuse
网站:https://caniuse-el.lruihao.cn/
目录
Hugo shortcode for CanIUse
在 Hugo 中使用 shortcode 方式内嵌 CanIUse 到你的文章中。


依赖
FixIt 主题 v1.0.0 及以上版本。
安装组件
和 安装主题 一样,安装方式有多种,选择其一即可,例如通过 Hugo Modules 安装:
| |
配置
为了通过 FixIt 主题开放的 自定义块 将 shortcode-caniuse.html 注入到 custom-assets 中,你需要填写以下必要配置:
| |
组件配置:
| |
使用 Shortcode
caniuse shortcode 有以下命名参数:
- feature [必需](第一个位置参数)特性名称
- baseline [可选](第二个位置参数)是否显示功能支持基线,默认为
false - past [可选](第三个位置参数)显示过去 N 个版本,范围是
0 - 5,默认为2 - future [可选](第四个位置参数)显示未来 N 个版本,范围是
0 - 3,默认为1 - origin [可选](第五个位置参数)caniuse embed 数据源,例如:
https://caniuse-embed-x.vercel.app - loading [可选](第六个位置参数)iframe 的加载策略(
eager或lazy),默认为lazy
点击
caniuse.com网站上功能左边#号,URL 中的pathname即为feature参数。
这是一个用法示例:
| |
参考
- <caniuse-embed> Element
- The CanIUse Embed — Add support tables to your site
- Can I use… Support tables for HTML5, CSS3, etc
致谢
Buy me a coffee~
支付宝
微信