1.0.0 • Published 7 years ago
markdown-it-iframe v1.0.0
markdown-it-iframe
Iframe (
<iframe>) tag plugin for markdown-it markdown parser.
v1.+ requires markdown-it v4.+, see changelog.
Markdown:
Below will render an iframe
/i/https://www.youtube.com/embed/qkcx0kf6jMEHTML:
<p>Below will render an iframe</p>
<div class="iframe-container">
<iframe frameborder="0" src="https://www.youtube.com/embed/qkcx0kf6jME"></iframe>
</div>Install
node.js, browser:
npm install markdown-it-iframe --save
bower install markdown-it-iframe --saveUse
var md = require('markdown-it')()
.use(require('markdown-it-iframe'));
md.render(/*...*/) // see example abovemarkdown-it-iframe also supports the following options:
{
allowfullscreen: true,
width: 800,
height: 600,
frameborder: 1, // default: 0
renderIframe: false // default: true
}If you want to do a live preview of markdown rendering you will run into performance
issues when the user is typing out a URL for the iframe. The reason for this is that
markdown-it tries to render the URL being typed out with every keystroke. To combat this
you can specify renderIframe: false. This will print a message with the markdown instead
of the actual iframe.
Differences in browser. If you load script directly into the page, without
package system, module will add itself globally as window.markdownitIframe.
License
1.0.0
7 years ago