JSPM

markdown-it-iframe

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 199
  • Score
    100M100P100Q81827F
  • License MIT

<iframe> tag for markdown-it markdown parser.

Package Exports

  • markdown-it-iframe

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (markdown-it-iframe) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

markdown-it-iframe

Build Status NPM version Coverage Status

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/qkcx0kf6jME

HTML:

<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 --save

Use

var md = require('markdown-it')()
            .use(require('markdown-it-iframe'));

md.render(/*...*/) // see example above

markdown-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

MIT