diff --git a/src/helpers/postcss_plugin.js b/src/helpers/postcss_plugin.js index b72e09f9..bc9945dd 100644 --- a/src/helpers/postcss_plugin.js +++ b/src/helpers/postcss_plugin.js @@ -10,7 +10,7 @@ * @param {(Function|Object)} func Function with PostCSS plugin interface. * @returns {Function} A PostCSS plugin. */ -function plugin(name, func) { +export function plugin(name, func) { return Object.defineProperty( function intrface(...args) { const retFunc = func.apply(this, args) diff --git a/src/helpers/split.js b/src/helpers/split.js index 9a1711f8..c8844394 100644 --- a/src/helpers/split.js +++ b/src/helpers/split.js @@ -2,14 +2,13 @@ /** * Split array into multiple arrays by specified condition. * - * @alias module:helpers/split * @param {Array} arr Target array. * @param {splitCallback} func Callback to split array. * @param {boolean} [keepSplitedValue=false] Keep splited value. The split * point is before the matched value. * @returns {Array[]} Splited array. */ -function split(arr, func, keepSplitedValue = false) { +export function split(arr, func, keepSplitedValue = false) { const ret = [[]] for (const value of arr) { diff --git a/src/helpers/wrap_array.js b/src/helpers/wrap_array.js index 1cc17e67..e0182104 100644 --- a/src/helpers/wrap_array.js +++ b/src/helpers/wrap_array.js @@ -2,11 +2,11 @@ /** * Wrap value in array if it is not an array. * - * @alias module:helpers/wrap_array + * @function wrapArray * @param {*} valOrArr * @return {Array} */ -const wrapArray = (valOrArr) => { +export const wrapArray = (valOrArr) => { if (valOrArr == null || valOrArr === false) return [] if (valOrArr instanceof Array) return valOrArr return [valOrArr] diff --git a/src/helpers/wrap_tokens.js b/src/helpers/wrap_tokens.js index ab1b1c26..ac8e1b7d 100644 --- a/src/helpers/wrap_tokens.js +++ b/src/helpers/wrap_tokens.js @@ -3,7 +3,6 @@ /** * Wrap array of tokens by specified container object. * - * @alias module:helpers/wrap_tokens * @param {Token} Token markdown-it's Token class. * @param {String} type Token type. It will be suffixed by `_open` / `_close`. * @param {Object} container A container object to wrap tokens, includes tag @@ -14,7 +13,7 @@ * @param {Token[]} [tokens=[]] Wrapping tokens. * @returns {Token[]} Wrapped tokens. */ -function wrapTokens(Token, type, container, tokens = []) { +export function wrapTokens(Token, type, container, tokens = []) { const { tag } = container // Update nesting level of wrapping tokens diff --git a/src/markdown/background_image.js b/src/markdown/background_image.js index 0f2884ef..246b7b09 100644 --- a/src/markdown/background_image.js +++ b/src/markdown/background_image.js @@ -17,13 +17,14 @@ import parse from './background_image/parse' * In addition to the basic background implementation, it supports multiple * background images, filters, and split background. * - * @alias module:markdown/background_image + * @function backgroundImage * @param {MarkdownIt} md markdown-it instance. */ -function backgroundImage(md) { +function _backgroundImage(md) { parse(md) apply(md) advanced(md) } -export default marpitPlugin(backgroundImage) +export const backgroundImage = marpitPlugin(_backgroundImage) +export default backgroundImage diff --git a/src/markdown/background_image/advanced.js b/src/markdown/background_image/advanced.js index 0aa3c4ff..eb9db0f7 100644 --- a/src/markdown/background_image/advanced.js +++ b/src/markdown/background_image/advanced.js @@ -1,6 +1,6 @@ /** @module */ import InlineStyle from '../../helpers/inline_style' -import wrapTokens from '../../helpers/wrap_tokens' +import { wrapTokens } from '../../helpers/wrap_tokens' import marpitPlugin from '../../plugin' /** @@ -10,10 +10,10 @@ import marpitPlugin from '../../plugin' * element(s) instead of CSS backgrounds. It works by creating the isolated * layer into inline SVG. * - * @alias module:markdown/background_image/advanced + * @function advancedBackground * @param {MarkdownIt} md markdown-it instance. */ -function advancedBackground(md) { +function _advancedBackground(md) { md.core.ruler.after( 'marpit_directives_apply', 'marpit_advanced_background', @@ -157,4 +157,5 @@ function advancedBackground(md) { ) } -export default marpitPlugin(advancedBackground) +export const advancedBackground = marpitPlugin(_advancedBackground) +export default advancedBackground diff --git a/src/markdown/background_image/apply.js b/src/markdown/background_image/apply.js index d51bb888..00dcdce7 100644 --- a/src/markdown/background_image/apply.js +++ b/src/markdown/background_image/apply.js @@ -9,10 +9,10 @@ import marpitPlugin from '../../plugin' * When inline SVG is enabled, it will reshape meta for advanced process instead * of converting to directives. * - * @alias module:markdown/background_image/apply + * @function backgroundImageApply * @param {MarkdownIt} md markdown-it instance. */ -function backgroundImageApply(md) { +function _backgroundImageApply(md) { md.core.ruler.after( 'marpit_inline_svg', 'marpit_apply_background_image', @@ -115,4 +115,5 @@ function backgroundImageApply(md) { ) } -export default marpitPlugin(backgroundImageApply) +export const backgroundImageApply = marpitPlugin(_backgroundImageApply) +export default backgroundImageApply diff --git a/src/markdown/background_image/parse.js b/src/markdown/background_image/parse.js index 91a69d7e..f88a9ef4 100644 --- a/src/markdown/background_image/parse.js +++ b/src/markdown/background_image/parse.js @@ -18,10 +18,10 @@ const splitSizeMatcher = /^(left|right)(?::((?:\d*\.)?\d+%))?$/ * * Furthermore, it parses additional keywords needed for background image. * - * @alias module:markdown/background_image/parse + * @function backgroundImageParse * @param {MarkdownIt} md markdown-it instance. */ -function backgroundImageParse(md) { +function _backgroundImageParse(md) { md.inline.ruler2.after( 'marpit_parse_image', 'marpit_background_image', @@ -75,4 +75,5 @@ function backgroundImageParse(md) { ) } -export default marpitPlugin(backgroundImageParse) +export const backgroundImageParse = marpitPlugin(_backgroundImageParse) +export default backgroundImageParse diff --git a/src/markdown/collect.js b/src/markdown/collect.js index 154018d4..a9e457fa 100644 --- a/src/markdown/collect.js +++ b/src/markdown/collect.js @@ -9,10 +9,10 @@ import marpitPlugin from '../plugin' * Marpit instance. It would use in the returned object from * {@link Marpit#render}. * - * @alias module:markdown/collect + * @function collect * @param {MarkdownIt} md markdown-it instance. */ -function collect(md) { +function _collect(md) { const { marpit } = md md.core.ruler.push('marpit_collect', (state) => { @@ -61,4 +61,5 @@ function collect(md) { }) } -export default marpitPlugin(collect) +export const collect = marpitPlugin(_collect) +export default collect diff --git a/src/markdown/comment.js b/src/markdown/comment.js index a5700634..f5d78292 100644 --- a/src/markdown/comment.js +++ b/src/markdown/comment.js @@ -1,6 +1,6 @@ /** @module */ import marpitPlugin from '../plugin' -import yaml from './directives/yaml' +import { yaml } from './directives/yaml' const commentMatcher = /