Exciting release!Introducing "safe npm". Learn more
Socket
Log inDemoInstall

@centerforopenscience/markdown-it-atrules

Package Overview
Dependencies
1
Maintainers
9
Versions
2
Issues
File Explorer

Advanced tools

@centerforopenscience/markdown-it-atrules

Markdown-it plugin to embed files with the OSF's MFR

    0.1.1latest
    GitHub

Version published
Maintainers
9
Weekly downloads
576
decreased by-33.41%

Weekly downloads

Readme

Source

markdown-it-atrules

Work in progess

markdown-it plugin for embedding MFR files.

Usage

Enable plugin
md = require('markdown-it')({ html: true, linkify: true, typography: true, }).use(require('../'), { type: 'osf', pattern: /^http(?:s?):\/\/(?:www\.)?[a-zA-Z0-9 .:]{1,}\/render\?url=http(?:s?):\/\/[a-zA-Z0-9 .:]{1,}\/([a-zA-Z0-9]{5})\/\?action=download|(^[a-zA-Z0-9]{5}$)/, format(assetID) { var id = '__markdown-it-atrules-' + (new Date()).getTime(); return '<div id="' + id + '" class="mfr mfr-file"></div>' + '<script>$(document).ready(function () {new mfr.Render("' + id + '", "' + getMfrUrl(assetID) + '"); }); </script>'; }
Inline style

This plugin is made to work in the inline style. If you'd like a block-style, you may be interested in https://github.com/rotorz/markdown-it-block-embed

OSF

This plugin allows you to use the OSF's Modualar File Renderer or the MFR to embed video or other files into your markdown assuming your page has mfr.js and mfr.css loaded.

@[osf](kuvg9)

is interpreted as

<p><div id="randomId" class="mfr mfr-file"></div><script>$(document).ready(function () {new mfr.Render("randomId", "https://mfr.osf.io/render?url=https://osf.io/kuvg9/?action=download%26mode=render"); }); </script></p>

Alternately, you could use the url.

@[osf](https://mfr.osf.io/render?url=https://osf.io/kuvg9/?action=download)

Keywords

FAQs

Last updated on 11 Oct 2018

Did you know?

Socket installs a Github app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.

Install Socket
Socket
support@socket.devSocket SOC 2 Logo

Product

  • Package Issues
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc