@vivliostyle/vfm
Custom Markdown syntax specialized in book authoring.
Last updated 4 months ago by uetchy .
Apache-2.0 · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @vivliostyle/vfm 
SYNC missed versions from official npm registry.

Vivliostyle Flavored Markdown

Vivliostyle Flavored Markdown (VFM), a Markdown syntax optimized for book authoring. It is standardized and published for Vivliostyle and its sibling projects.

Table of contents

Use

npx @vivliostyle/vfm --help
npx @vivliostyle/vfm input.md
echo "# Hello" | npx @vivliostyle/vfm

# or install it globally
npm i -g @vivliostyle/vfm
vfm input.md

Usage with vivliostyle command

npm i -g @vivliostyle/vfm @vivliostyle/cli
vfm README.md --stylesheet https://raw.githubusercontent.com/jagat-xpub/cosmology/gh-pages/css/scholarly.css > book.html
vivliostyle build book.html -s A4

API

yarn add @vivliostyle/vfm
const {stringify} = require('@vivliostyle/vfm');

console.log(
  stringify(`
# はじめに

{Vivliostyle|ビブリオスタイル}の世界へようこそ。
`),
);

This snippet will generates:

<!DOCTYPE html>
<html lang="ja">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
  </head>
  <body>
    <h1>はじめに</h1>
    <p>
      <ruby>Vivliostyle<rt>ビブリオスタイル</rt></ruby
      >の世界へようこそ。
    </p>
  </body>
</html>

Options

stylesheet (default: undefined)

stringify('# Hello', {stylesheet: 'https://example.com/book.css'});

will generates:

<!DOCTYPE html>
<html lang="ja">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <link rel="stylesheet" href="https://example.com/book.css" />
  </head>
  <body>
    <p><h1>Hello</h1></p>
  </body>
</html>

partial (default: false)

stringify('# Hello', {partial: true});

will generates:

<p><h1>Hello</h1></p>

Advanced usage

Integrate into Unified.js pipeline

import unified from 'unified';
import vfm from '@vivliostyle/vfm/lib/revive-parse';
import html from '@vivliostyle/vfm/lib/revive-rehype';

function main() {
  unified()
    .use(vfm)
    .use(customRemarkPlugin)
    .use(html)
    .use(customRehypePlugin)
    .processSync('# Hello');
}

Spec

Principles

  1. Open: steadily improving through open discussion and feedback from the vast community.
  2. Consistent: Provides reference implementation for parsing and converting VFM to HTML, allowing other non Vivliostyle projects to use this syntax for their purposes.

Links

Current Tags

  • 1.0.0-alpha.6                                ...           latest (4 months ago)
  • 1.0.0-alpha.10                                ...           next (4 months ago)

11 Versions

  • 1.0.0-alpha.10                                ...           4 months ago
  • 1.0.0-alpha.9                                ...           4 months ago
  • 1.0.0-alpha.8                                ...           4 months ago
  • 1.0.0-alpha.7                                ...           4 months ago
  • 1.0.0-alpha.6                                ...           4 months ago
  • 1.0.0-alpha.5                                ...           4 months ago
  • 1.0.0-alpha.4                                ...           4 months ago
  • 1.0.0-alpha.3                                ...           4 months ago
  • 1.0.0-alpha.2                                ...           4 months ago
  • 1.0.0-alpha.1                                ...           4 months ago
  • 1.0.0-alpha.0                                ...           4 months ago
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 0
Last Month 0
Dependencies (23)
Dev Dependencies (15)

Copyright 2014 - 2016 © taobao.org |