npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@elasticpath/remarkable-oembed

v1.1.0

Published

Plugin for remarkable markdown parser for embedding rich media from external sites using oEmbed API and specs

Downloads

899

Readme

Remarkable oEmbed Plugin

This repository builds a plugin for Remarkable markdown parser that allows embedding external contents, e.g. videos, to Markdown documents.

The plugin provides a custom Markdown syntax that can be used in Markdown document to embed external contents using a URL, like embedding an image. It expects external contents to be available from the provided URL following the oEmbed specs.

Installation

Add remarkable-oembed to your project using a package manager. For example:

Using yarn:

yarn add @elasticpath/remarkable-oembed --dev

Using npm:

npm install @elasticpath/remarkable-oembed --save-dev

Usage

Enable the remarkable-oembed plugin and let Remarkable parse the markdown content:

const { Remarkable } = require('remarkable')
const remarkableOembed = require('@elasticpath/remarkable-oembed')

let md = new Remarkable().use(remarkableOembed)
md.render('!oembed[](https://www.youtube.com/watch?v=7ALwNmwYxBg)')

Above markdown content will be parsed and give you following html:

<div class="oembed oembed-video"><iframe src="https://www.youtube.com/embed/7ALwNmwYxBg?feature=oembed" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen="" width="200" height="113" frameborder="0"></iframe></div>

See the next section for more details on the syntax.

Markdown syntax processed by remarkable-oembed

  • With an alternative text and title:

    !oembed[alternative text](source url "title")
    
    !oembed[A Youtube video about Elastic Path Commerce Cloud](https://www.youtube.com/watch?v=7ALwNmwYxBg "What is Elastic Path Commerce Cloud")
  • With an alternative text only:

    !oembed[alternative text](source url)
    
    !oembed[A Youtube video about Elastic Path Commerce Cloud](https://www.youtube.com/watch?v=7ALwNmwYxBg)

    Note: Please make sure that there is no space between your source URL and the closing bracket.

    !oembed[A Youtube video about Elastic Path Commerce Cloud](https://www.youtube.com/watch?v=7ALwNmwYxBg     )

    The Markdown above will not work.

  • With a title only:

    !oembed[](source url "title")
    
    !oembed[](https://www.youtube.com/watch?v=7ALwNmwYxBg "What is Explains Elastic Path Commerce Cloud")
  • With no alternative text or title:

    !oembed[](source url)
    
    !oembed[](https://www.youtube.com/watch?v=7ALwNmwYxBg)

You can add extra configuration to the oEmbed URL by adding extra query parameters to the end of the source url.

For instance, maxwidth and maxheight are two valid request parameters for rich and video type according to section 2.3.4.2. The video type and 2.3.4.4. The rich type from oembed. You can specify the width and height by adding &maxwidth= and &maxheight= to the end of the source url:

!oembed[](https://www.youtube.com/watch?v=7ALwNmwYxBg&maxwidth=100&maxheight=500)

There are also custom options implemented by each provider, e.g. theme option for codesandbox. According to its documentation, you could trigger the light theme by adding ?theme=light to the end of the source url:

!oembed[](https://codesandbox.io/s/react-new?theme=light)

Development

Pre-requisites

Git

Git is required if you would like to work with this repository on your local machine or would like to contribute changes to this repository.

EditorConfig

This repository is also configured with "EditorConfig" to make sure everyone's favourite editor is configured the same way, such as: using spaces for indentation, new line at the end of file, etc. Some editors have built-in support for EditorConfig. Please download and install EditorConfig plugin for your Editor, if you're using one of the editors that does not have this support out of the box.

Working with this repo

Below are some useful commands that can be executed from the root of this repository in your terminal.

  • ./gradlew clean: Removes build directory so that you have a fresh build result.

  • ./gradlew rollup: Bundles the .js files for NPM release.

  • ./gradlew unit_test: Runs the mocha unit tests for the source files in src directory. Generates reports in build/test-report and build/coverage-report directories as well as your terminal.

  • ./gradlew lint: Runs the eslint for all .js files. Generates reports in build/lint-report directory as well as your terminal.

  • ./gradlew test: Runs all test related gradle tasks, including unit_test and lint.

Commit convention

Publishing to NPM and releasing in GitHub is automated by the CI/CD pipeline in this repo, and uses Semantic Release, commit messages must follow the format described in the documentation for a release to be triggered.