
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
codeblock-iframe
Advanced tools
A library that can let you use iframe in markdown extra syntax securely!
A library that can let you use iframe in markdown extra syntax securely! This is the version for getting script from CDN
If you want to use it with webpack, plz use toml2iframe instead!
In the Demo, You can experience how it works!
Add script from CDN
<script src="https://cdn.jsdelivr.net/npm/codeblock-iframe@latest/dist/index.min.js"></script>
Use the functions from this library via the global variable __codeblock_iframe
// iframe attributes
const content = `
src="www.baidu.com"
width="100%"
height="500"
`
const converter_result = window.__codeblock_iframe.converter(content)
const filter_result = window.__codeblock_iframe.filter(content, ["www.baidu.com", "www.google.com"])
console.log(converter_result)
// output: [
// '<iframe src="www.baidu.com" width="100%" height="500"></iframe>',
// true,
// [ 'src', 'width', 'height' ]
//]
console.log(filter_result)
// output: [ true, 'www.baidu.com' ]
Following formats of src are supported!
www.baidu.com
//www.baidu.com
http://www.baidu.com
https://www.baidu.com
| Attributes |
|---|
| src |
| height |
| width |
| align |
| frameborder |
| longdesc |
| marginheight |
| marginwidth |
| name |
| sandbox |
| scrolling |
| seamless |
| srcdoc |
| textContent |
| Param | Type | Description |
|---|---|---|
| content | string | Iframe's attributes (including textContent for children) using standard TOML syntax |
| filters | Array<string> | Allowed domain list (required in filter function, DO NOT WITH Protocol) |
converter(content: string, filters?: Array<string>): for convertering attributes to iframefilter(content: string, filters: Array<string>): for filtering domainsFor converter(content: string, filters?: Array<string>): [ result, if passed filter?, [ attributes' names for debug ] ]
For filter(content: string, filters: Array<string>): [ if passed filter?, domain (if src's value is not the valid uri, return raw src's value) ]
/www.baidu.comis not the valid uri, plz usewww.baidu.comdirectly! If you want to use same origin page, plz don't input thefiltersparam, you will get nothing forconverterfunction!!! Or, you give the complete path forsrcand add your same origin page's domain tofiltersparam, it will work!!
To be honest, Markdown supports HTML tags natively! But here are some issues we have to face as followed:
Code Block Renderer is easy for us to extend native markdown syntax, so we can limit the frequency of iframe rendering in this way.
FAQs
A library that can let you use iframe in markdown extra syntax securely!
The npm package codeblock-iframe receives a total of 23 weekly downloads. As such, codeblock-iframe popularity was classified as not popular.
We found that codeblock-iframe demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.