0.2.0 • Published 2 years ago
html2oembed v0.2.0
html2oembed
Create oEmbed JSON from HTML
Install
Install with npm:
$ npm install --save-dev html2oembed
Basic usage
Via code:
const html2oembed = require('html2oembed');
const html = '<html><head><title>My awesome app</title><link href="/css/app.61f9f8cc.css" rel="stylesheet"></head><body><div id="app"></div><script type="text/javascript" src="/js/chunk-vendors.e42a3317.js"></script><script type="text/javascript" src="/js/app.c0e16a2e.js"></script></body></html>';
const parsed = html2oembed.parse(html);
const json = JSON.stringify(parsed);
Via CLI:
# Display help
$ npx html2oembed --help
# Convert HTML to oEmbed JSON
$ npx html2oembed convert ./index.html ./oembed.json
Sample output
{
"version": "1.0",
"type": "rich",
"title": "My awesome app",
"html": "<link href=\"/css/app.61f9f8cc.css\" rel=\"stylesheet\"><div id=\"app\"></div><script type=\"text/javascript\" src=\"/js/chunk-vendors.e42a3317.js\"></script><script type=\"text/javascript\" src=\"/js/app.c0e16a2e.js\"></script>",
"width": "100%",
"height": "100%"
}
Change log
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING and CODE_OF_CONDUCT for details.
Security
If you discover any security related issues, please email security@swis.nl instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
This package is Treeware. If you use it in production, then we ask that you buy the world a tree to thank us for our work. By contributing to the Treeware forest you’ll be creating employment for local families and restoring wildlife habitats.
SWIS :heart: Open Source
SWIS is a web agency from Leiden, the Netherlands. We love working with open source software.