1.0.0 • Published 6 years ago

moleculer-markdown v1.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

Moleculer logo

moleculer-markdown

Service mixin to transform markdown to html,

Uses Showdown as markdown processor.

Usage

'use strict';

let { ServiceBroker } = require('moleculer');
let MarkdownService = require('./../src/index');

// Create broker
let broker = new ServiceBroker({
  logger: console,
  logLevel: 'debug'
});

// Load markdown Service
broker.createService({
  name: 'markdown',
  mixins: [MarkdownService],
  settings: {}
});

// Start server
broker.start().then(() => {
  // Call action
  broker
    .call('markdown.transform', { md: '# Hello, Markdown' })
    .then(html => console.log('HTML is ', html));
});

Settings

PropertyTypeDefaultDescription
omitExtraWLInCodeBlocksBooleanrequiredOmit the trailing newline in a code block.
noHeaderIdBooleanrequiredDisable the automatic generation of header ids
customizedHeaderIdBooleanrequiredUse text in curly braces as header id
ghCompatibleHeaderIdBooleanrequiredGenerate header ids compatible with github style
prefixHeaderIdBooleanrequiredAdd a prefix to the generated header ids
rawPrefixHeaderIdBooleanrequiredSetting this option to true will prevent showdown from modifying the prefix
rawHeaderIdBooleanrequiredRemove only spaces, ' and " from generated header ids (including prefixes), replacing them with dashes (-)
parseImgDimensionsBooleanrequiredEnable support for setting image dimensions from within markdown syntax
headerLevelStartIntegerrequiredSet the header starting level
simplifiedAutoLinkBooleanrequiredTurning this option on will enable automatic linking to urls
excludeTrailingPunctuationFromURLsBooleanrequiredThis option excludes trailing punctuation from autolinking urls
literalMidWordUnderscoresBooleanrequiredTurning this on will stop showdown from interpreting underscores in the middle of words
strikethroughBooleanrequiredEnable support for strikethrough syntax
tablesBooleanrequiredEnable support for tables syntax
tablesHeaderIdBooleanrequiredIf enabled adds an id property to table headers tags
ghCodeBlocksBooleanrequiredEnable support for GFM code block style
tasklistsBooleanrequiredEnable support for GFM tasklists
smartIndentationFixBooleanrequiredTries to smartly fix indentation problems related to es6 template strings in the midst of indented code
disableForced4SpacesIndentedSublistsBooleanrequiredDisables the requirement of indenting sublists by 4 spaces for them to be nested, effectively reverting to the old behavior where 2 or 3 spaces were enough
simpleLineBreaksBooleanrequiredParses line breaks as like GitHub does, without needing 2 spaces at the end of the line
requireSpaceBeforeHeadingTextBooleanrequiredMakes adding a space between # and the header text mandatory
ghMentionsBooleanrequiredEnables github @mentions, which link to the username mentioned
ghMentionsLinkStringrequiredChanges the link generated by @mentions. Showdown will replace {u} with the username
encodeEmailsBooleanrequiredEnable e-mail addresses encoding through the use of Character Entities, transforming ASCII e-mail addresses into its equivalent decimal entities
openLinksInNewWindowBooleanrequiredOpen all links in new windows
backslashEscapesHTMLTagsBooleanrequiredSupport for HTML Tag escaping
emojiBooleanrequiredEnable emoji support
underlineBooleanrequiredEXPERIMENTAL: Enable support for underline, no longer rendered to and
completeHTMLDocumentBooleanrequiredOutputs a complete html document, including , and tags' instead of an HTML fragment
metadataBooleanrequiredEnable support for document metadata
splitAdjacentBlockquotesBooleanrequiredSplit adjacent blockquote blocks
flavorStringrequiredSet the flavor for markdown. Options are: original, github, vanilla

Actions

Methods

transform

Transforms markdown into html

Parameters

PropertyTypeDefaultDescription
mdString-The markdown

Results

Type: String