JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 25
  • Score
    100M100P100Q53990F
  • License MIT

A markdown parser, compiler, and viewer (via "marked").

Package Exports

  • extra-marked

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (extra-marked) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

A markdown parser, compiler, and viewer (via "marked").

Do you want to:

  • Get markdown files as HTML?
  • Or, Read markdown files in terminal?

setup

  1. Install Node.js, if not installed.
  2. Run npm install -g extra-marked in console.
  3. To install this as a package use npm install extra-marked.

console

marked README.md
# view README.md

cat README.md | marked
# view README.md

marked README.md > README.html
# get README.md as HTML

marked -i README.md --sanitize -o README.html
# ignore HTML in markdown

marked -i README.md --no-gfm -o README.html
# disable GFM in markdown

marked -i README.md -v | more
# view README.md with more
# (when piping view needs enabling)

marked -i README.md --view_heading red.bold
# view README.md with red and bold headings
# (view is enabled by default when not piping)

reference

marked [options] <input>
# input: input markdown file

# Options:
# --help:         show this help
# -o, --output:   set output file
# -i, --input:    set input markdown file
# -s, --string:   set input markdown string
# -t, --tokens:   enable tokens (0)
# -v, --view:     view as markdown (0)
# --baseurl:      set prefix URL for any relative link
# --breaks:       enable adding <br> on a single line break. requires GFM enabled (0)
# --gfm:          enable use of GitHub Flavored Markdown specification (1)
# --headerids:    enable including id attribute when emitting headings (1)
# --headerprefix: set string to prefix the id attribute when emitting headings
# --langprefix:   set string to prefix the className in a <code> block. useful for syntax highlighting (language-)
# --mangle:       enable escaping autolinked email address with HTML character references (1)
# --pedantic:     enable conform to the original markdown.pl as much as possible. dont fix original markdown bugs or behavior. turns off and overrides gfm. (0)
# --sanitize:     enable sanitizing the HTML passed into markdownString with the sanitizer function (0)
# --silent:       enable silent parsing (0)
# --smartlists:   enable using smarter list behavior than those found in markdown.pl (0)
# --tables:       enable using GFM tables extension, when gfm is also enabled (1)
# --xhtml:        enable emitting self-closing HTML tags for void elements (<br/>, <img/>, etc.) with a "/" as required by XHTML (0)
# --no-breaks:     disable breaks
# --no-gfm:        disable GFM
# --no-headerids:  disable header IDs
# --no-mangle:     disable mangle
# --no-pedantic:   disable pednatic
# --no-sanitize:   disable sanitize
# --no-silent:     disable silent
# --no-smartlists: disable smart lists
# --no-tables:     disable tables
# --no-xhtml:      disable XHTML
# --view_code:         set code color (yellow)
# --view_blockquote:   set blockquote color (gray.italic)
# --view_html:         set html color (gray)
# --view_heading:      set heading color (green.bold)
# --view_firstheading: set first heading color (magenta.underline.bold)
# --view_hr:           set hr color (reset)
# --view_listitem:     set list item color (reset)
# --view_table:        set table color (reset)
# --view_paragraph:    set paragraph color (reset)
# --view_strong:       set strong color (bold)
# --view_em:           set em color (italic)
# --view_codespan:     set code span color (yellow)
# --view_del:          set del color (dim.gray.strikethrough)
# --view_link:         set link color (blue)
# --view_href:         set href color (blur.underline)
# --view_text:         set text color
# --view_unescape:     enable unescape (1)
# --view_emoji:        enable emoji (1)
# --view_width:        set width (80)
# --view_showsectionprefix: enable show section prefix (1)
# --view_showhref:          enable show href (0)
# --view_reflowtext:        enable reflow text (0)
# --view_tab:               set tab (4)
# --no-view_unescape: disbale unescape
# --no-view_emoji:    disable emoji
# --no-view_showsectionprefix: disable show section prefix
# --no-view_showhref:          disable show href
# --no-view_reflowtext:        disable reflow text

# Environment variables:
$MARKED_OUTPUT   # set output file
$MARKED_INPUT    # set input markdown file
$MARKED_STRING   # set input markdown string
$MARKED_TOKENS   # enable tokens (0)
$MARKED_VIEW     # view as markdown (0)
$MARKED_BASEURL      # set prefix URL for any relative link
$MARKED_BREAKS       # enable adding <br> on a single line break. requires GFM enabled (0)
$MARKED_GFM          # enable use of GitHub Flavored Markdown specification (1)
$MARKED_HEADERIDS    # enable including id attribute when emitting headings (1)
$MARKED_HEADERPREFIX # set string to prefix the id attribute when emitting headings
$MARKED_LANGPREFIX   # set string to prefix the className in a <code> block. useful for syntax highlighting (language-)
$MARKED_MANGLE       # enable escaping autolinked email address with HTML character references (1)
$MARKED_PEDANTIC     # enable conform to the original markdown.pl as much as possible. dont fix original markdown bugs or behavior. turns off and overrides gfm. (0)
$MARKED_SANITIZE     # enable sanitizing the HTML passed into markdownString with the sanitizer function (0)
$MARKED_SILENT       # enable silent parsing (0)
$MARKED_SMARTLISTS   # enable using smarter list behavior than those found in markdown.pl (0)
$MARKED_TABLES       # enable using GFM tables extension, when gfm is also enabled (1)
$MARKED_XHTML        # enable emitting self-closing HTML tags for void elements (<br/>, <img/>, etc.) with a "/" as required by XHTML (0)
$MARKED_VIEW_CODE         # set code color (yellow)
$MARKED_VIEW_BLOCKQUOTE   # set blockquote color (gray.italic)
$MARKED_VIEW_HTML         # set html color (gray)
$MARKED_VIEW_HEADING      # set heading color (green.bold)
$MARKED_VIEW_FIRSTHEADING # set first heading color (magenta.underline.bold)
$MARKED_VIEW_HR           # set hr color (reset)
$MARKED_VIEW_LISTITEM     # set list item color (reset)
$MARKED_VIEW_TABLE        # set table color (reset)
$MARKED_VIEW_PARAGRAPH    # set paragraph color (reset)
$MARKED_VIEW_STRONG       # set strong color (bold)
$MARKED_VIEW_EM           # set em color (italic)
$MARKED_VIEW_CODESPAN     # set code span color (yellow)
$MARKED_VIEW_DEL          # set del color (dim.gray.strikethrough)
$MARKED_VIEW_LINK         # set link color (blue)
$MARKED_VIEW_HREF         # set href color (blur.underline)
$MARKED_VIEW_TEXT         # set text color
$MARKED_VIEW_UNESCAPE     # enable unescape (1)
$MARKED_VIEW_EMOJI        # enable emoji (1)
$MARKED_VIEW_WIDTH        # set width (80)
$MARKED_VIEW_SHOWSECTIONPREFIX # enable show section prefix (1)
$MARKED_VIEW_SHOWHREF          # enable show href (0)
$MARKED_VIEW_REFLOWTEXT        # enable reflow text (0)
$MARKED_VIEW_TAB               # set tab (4)

package

const googletts = require('extra-googletts');

await googletts('out.mp3', 'I want to order a stuffed crust pizza');
// out.mp3 created (yay!)

const fs = require('fs');
var speech = fs.readFileSync('speech.txt', 'utf8');
await googletts('speech.mp3', speech)
// speech.mp3 created from text in speech.txt

await googletts('out.mp3', 'Hello 911, my husband is in danger!', {
  voice: {ssmlGender: 'FEMALE'}
});
// out.mp3 created with female voice

await googletts('out.mp3', 'Dead man walking.', {
  voice: {name: 'en-US-Wavenet-B'}, log: true
});
// out.mp3 created with different male voice (log enabled)

reference

const googletts = require('extra-googletts');

googletts(output, text, options={})
// output:  output audio file
// text:    input text
// options: given below
// -> Promise <topic timetable>

// Default options:
options = {
  stdio: [0, 1, 2], // set child process stdio
  log: false,       // enable log
  retries: 3,       // set speech synthesis retries
  credentials: {
    keyFilename: '' // path to credentials
    // see other TTS client options below
  },
  acodec: 'copy',    // set audio acodec
  voice: {
    languageCode: 'en-US',   // set voice language code
    ssmlGender: 'NEUTRAL'    // set voice SSML gender
    name: 'en-US-Wavenet-D', // set voice name
  }
  quote: {
    breakTime: 250,           // set quoted text break time
    emphasisLevel: 'moderate' // set quoted text emphasis level
  },
  heading: {
    breakTime: 4000,         // set heading text break time
    breakDiff: 250,          // set heading text break difference
    emphasisLevel: 'strong', // set heading text emphasis level
  },
  ellipsis: {
    breakTime: 1500 // set ellipsis break time
  },
  dash: {
    breakTime: 500  // set dash break time
  },
  newline: {
    breakTime: 1000 // set newline break time
  },
  block: {
    length: 5000,  // set SSMLs block length
    separator: '.' // set SSMLs block separator
  }
}

similar

Do you need anything similar?

Suggestions are welcome. Please create an issue.

nodef

References: SSML, TTS voices, TTS client docs.