Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

remarkable-front-matter

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

remarkable-front-matter

YAML front matter block support for Remarkable

  • 1.0.1-beta.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

remarkable-front-matter

Make Remarkable Extensible Markdown Parser process the file with a YAML front matter block ahead of a markdown file. This design is inspired by Jekyll's Front Matter.

Here is a basic example:

---
title: ManDoc: Leverage your Reusable Knowledge posted in Markdown.
author:  Richard Lea
---

The front matter must take the form of valid YAML set between triple-dashed lines. Between these triple-dashed lines, you can set predefined variables or even create custom ones of your own.

These variables will then be available to template package to access and render in any layouts or create some interesting rendering logic for that page or post , for example in question relies on.

Installation

$ npm install remarkable-front-matter

Quick Start

Given a sample markdown string started by a YAML meta data surrounded by triple-dashed lines, ---, to render, the YAML front-matter could be availabe through remarkable render env, the key-value store created by parsing rules:

import frontMatterPlugin from 'remarkable-front-matter';

// Init Remarkable Renderer Instance with frontMatterPlugin loading.
const md = new Remarkable();
md.use(frontMatterPlugin);

// Prepare an environment mapping object for keeping frontMatter Data later.
const env = {frontMatter: undefined};
md.render([
    '---',
    'title: Remarkable-Front-Matter README',
    'date: 2018-12-10 15:15:19',
    '---',
].join('\n'), env);

console.log(env);
/**
 * Will Output:
 * { title: 'Remarkable-Front-Matter README', date: 2018-12-10T15:15:19.000Z }
 /

All the examples above are written in TypeScript, which means that JavaScript usage is surely without problem.

However, I found that the design of Remarkable itself is actually not friendly for TypeScript Users to develop plugins, as well.

Keywords

FAQs

Package last updated on 10 Dec 2018

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc