Awesome
docsify-codeblock-iframe
A plugin that provides markdown extra codeblock-iframe syntax support for docsify, just for supporting iframe rendering securely!
Try it
Usage
Import dependencies from CDN
<script src="//cdn.jsdelivr.net/npm/codeblock-iframe@latest/dist/index.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/docsify-codeblock-iframe@latest/dist/index.min.js"></script>
Following formats of src
are supported!
www.baidu.com
//www.baidu.com
http://www.baidu.com
https://www.baidu.com
- iframe Attributes
Attributes |
---|
src |
height |
width |
align |
frameborder |
longdesc |
marginheight |
marginwidth |
name |
sandbox |
scrolling |
seamless |
srcdoc |
textContent |
Why To Do
To be honest, Markdown supports HTML tags natively! But here are some issues we have to face as followed:
- If I didn't want my users insert ads in their posts via iframe but supported them using codepen to share their codes, how could I do?
- Sometimes we try to insert iframe in some markdown editor. For immediately rendering, the browser will send a lot of GET requests to our target website when we inputting, how could we optimize? Even it causes our page breakdown when developing and using SSR
How To Do
Code Block Renderer is easy for us to extend native markdown syntax, so we can limit the frequency of iframe rendering in this way.
Thanks
- iarna-toml: Better TOML parsing and stringifying all in that familiar JSON interface.