npm

@folkdb/vextab-render-svg

1.0.1 • Public • Published

@folkdb/vextab-render-svg

Render VexTab to SVG in a Node environment

Install

npm i @folkdb/vextab-render-svg

Usage

This package is released as an ES module only. Minimum Node.js version is 12 (latest LTS as of release date). CommonJS require() is not supported.

import vextabRenderSvg from '@folkdb/vextab-render-svg'

(async () => {
  const svg = await vextabRenderSvg(`
    tabstave notation=true key=A time=4/4
    notes :q =|: (5/2.5/3.7/4) :8 7-5/3 5h6-7/5 ^3^ :q 7V/4
  `);
  
  // do something with SVG
})();
  

API

The module's default export is a function with the following parameters:

function(content: string, {
  width = 640,
  offset = [0, 0],
  ...options
} = {}): string

Required

  • content: the VexTab string to be rendered to SVG

Rendering Options

  • width: set the width of the stave in pixels
  • offset: set the [x, y] offset of the stave from the upper-left corner of the canvas
  • options: additional options passed to the VexTab's Artist constructor

Package Sidebar

Install

npm i @folkdb/vextab-render-svg

Weekly Downloads

1

Version

1.0.1

License

ISC

Unpacked Size

4.63 kB

Total Files

4

Last publish

Collaborators

  • danielnarey