@marp-team/marpit
Advanced tools
Comparing version 2.4.1 to 2.4.2
@@ -7,5 +7,3 @@ "use strict"; | ||
exports.marpitContainer = exports.default = void 0; | ||
/** @module */ | ||
/** | ||
@@ -48,3 +46,2 @@ * Marpit element class. | ||
}); | ||
for (const attr of Object.keys(attributes)) { | ||
@@ -56,7 +53,6 @@ Object.defineProperty(this, attr, { | ||
} | ||
Object.freeze(this); | ||
} | ||
} | ||
} | ||
/** | ||
@@ -70,4 +66,2 @@ * Marpit's default container. | ||
*/ | ||
const marpitContainer = new Element('div', { | ||
@@ -74,0 +68,0 @@ class: 'marpit' |
@@ -7,7 +7,4 @@ "use strict"; | ||
exports.default = void 0; | ||
var _postcss = _interopRequireDefault(require("postcss")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/** | ||
@@ -31,3 +28,2 @@ * InlineStyle helper class. | ||
this.decls = {}; | ||
if (initialDecls) { | ||
@@ -38,3 +34,2 @@ if (initialDecls instanceof InlineStyle || typeof initialDecls === 'string') { | ||
}); | ||
root.each(node => { | ||
@@ -44,3 +39,4 @@ if (node.type === 'decl') this.decls[node.prop] = node.value; | ||
} else { | ||
this.decls = { ...initialDecls | ||
this.decls = { | ||
...initialDecls | ||
}; | ||
@@ -50,2 +46,3 @@ } | ||
} | ||
/** | ||
@@ -57,4 +54,2 @@ * Delete declaration. | ||
*/ | ||
delete(prop) { | ||
@@ -64,2 +59,3 @@ delete this.decls[prop]; | ||
} | ||
/** | ||
@@ -72,4 +68,2 @@ * Set declaration. | ||
*/ | ||
set(prop, value) { | ||
@@ -79,2 +73,3 @@ this.decls[prop] = value; | ||
} | ||
/** | ||
@@ -85,10 +80,6 @@ * Build a string of declarations for the inline style. | ||
*/ | ||
toString() { | ||
let built = ''; | ||
for (const prop of Object.keys(this.decls)) { | ||
let parsed; | ||
try { | ||
@@ -98,5 +89,5 @@ parsed = _postcss.default.parse(`${prop}:${this.decls[prop]}`, { | ||
}); | ||
} catch (e) {// A declaration that have value it cannot parse will ignore. | ||
} catch (e) { | ||
// A declaration that have value it cannot parse will ignore. | ||
} | ||
if (parsed) { | ||
@@ -109,8 +100,5 @@ parsed.each(node => { | ||
} | ||
return built; | ||
} | ||
} | ||
exports.default = InlineStyle; |
@@ -7,3 +7,3 @@ "use strict"; | ||
exports.default = void 0; | ||
exports.plugin = plugin; | ||
/** @module */ | ||
@@ -33,4 +33,3 @@ | ||
} | ||
var _default = plugin; | ||
exports.default = _default; |
@@ -7,9 +7,7 @@ "use strict"; | ||
exports.default = void 0; | ||
exports.split = split; | ||
/** @module */ | ||
/** | ||
* Split array into multiple arrays by specified condition. | ||
* | ||
* @alias module:helpers/split | ||
* @param {Array} arr Target array. | ||
@@ -23,3 +21,2 @@ * @param {splitCallback} func Callback to split array. | ||
const ret = [[]]; | ||
for (const value of arr) { | ||
@@ -38,7 +35,5 @@ /** | ||
} | ||
return ret; | ||
} | ||
var _default = split; | ||
exports.default = _default; |
@@ -6,10 +6,8 @@ "use strict"; | ||
}); | ||
exports.default = void 0; | ||
exports.wrapArray = exports.default = void 0; | ||
/** @module */ | ||
/** | ||
* Wrap value in array if it is not an array. | ||
* | ||
* @alias module:helpers/wrap_array | ||
* @function wrapArray | ||
* @param {*} valOrArr | ||
@@ -23,4 +21,4 @@ * @return {Array} | ||
}; | ||
exports.wrapArray = wrapArray; | ||
var _default = wrapArray; | ||
exports.default = _default; |
@@ -7,3 +7,3 @@ "use strict"; | ||
exports.default = void 0; | ||
exports.wrapTokens = wrapTokens; | ||
/** @module */ | ||
@@ -14,3 +14,2 @@ | ||
* | ||
* @alias module:helpers/wrap_tokens | ||
* @param {Token} Token markdown-it's Token class. | ||
@@ -29,22 +28,24 @@ * @param {String} type Token type. It will be suffixed by `_open` / `_close`. | ||
tag | ||
} = container; // Update nesting level of wrapping tokens | ||
} = container; | ||
for (const t of tokens) t.level += 1; // Create markdown-it tokens | ||
// Update nesting level of wrapping tokens | ||
for (const t of tokens) t.level += 1; | ||
// Create markdown-it tokens | ||
const open = new Token(`${type}_open`, tag, 1); | ||
const close = new Token(`${type}_close`, tag, -1); | ||
Object.assign(open, { ...(container.open || {}) | ||
Object.assign(open, { | ||
...(container.open || {}) | ||
}); | ||
Object.assign(close, { ...(container.close || {}) | ||
}); // Assign attributes | ||
Object.assign(close, { | ||
...(container.close || {}) | ||
}); | ||
// Assign attributes | ||
for (const attr of Object.keys(container)) { | ||
if (!['open', 'close', 'tag'].includes(attr) && container[attr] != null) open.attrSet(attr, container[attr]); | ||
} | ||
return [open, ...tokens, close]; | ||
} | ||
var _default = wrapTokens; | ||
exports.default = _default; |
@@ -31,14 +31,8 @@ "use strict"; | ||
exports.default = void 0; | ||
var _element = _interopRequireDefault(require("./element")); | ||
var _marpit = _interopRequireDefault(require("./marpit")); | ||
var _theme = _interopRequireDefault(require("./theme")); | ||
var _theme_set = _interopRequireDefault(require("./theme_set")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var _default = _marpit.default; | ||
exports.default = _default; |
@@ -6,14 +6,8 @@ "use strict"; | ||
}); | ||
exports.default = void 0; | ||
exports.default = exports.backgroundImage = void 0; | ||
var _plugin = _interopRequireDefault(require("../plugin")); | ||
var _advanced = _interopRequireDefault(require("./background_image/advanced")); | ||
var _apply = _interopRequireDefault(require("./background_image/apply")); | ||
var _parse = _interopRequireDefault(require("./background_image/parse")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/** @module */ | ||
@@ -34,6 +28,6 @@ | ||
* | ||
* @alias module:markdown/background_image | ||
* @function backgroundImage | ||
* @param {MarkdownIt} md markdown-it instance. | ||
*/ | ||
function backgroundImage(md) { | ||
function _backgroundImage(md) { | ||
(0, _parse.default)(md); | ||
@@ -43,5 +37,5 @@ (0, _apply.default)(md); | ||
} | ||
var _default = (0, _plugin.default)(backgroundImage); | ||
const backgroundImage = (0, _plugin.default)(_backgroundImage); | ||
exports.backgroundImage = backgroundImage; | ||
var _default = backgroundImage; | ||
exports.default = _default; |
@@ -6,12 +6,7 @@ "use strict"; | ||
}); | ||
exports.default = void 0; | ||
exports.default = exports.advancedBackground = void 0; | ||
var _inline_style = _interopRequireDefault(require("../../helpers/inline_style")); | ||
var _wrap_tokens = _interopRequireDefault(require("../../helpers/wrap_tokens")); | ||
var _wrap_tokens = require("../../helpers/wrap_tokens"); | ||
var _plugin = _interopRequireDefault(require("../../plugin")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/** @module */ | ||
@@ -26,10 +21,9 @@ | ||
* | ||
* @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', state => { | ||
let current; | ||
const newTokens = []; | ||
for (const t of state.tokens) { | ||
@@ -44,8 +38,9 @@ if (t.type === 'marpit_inline_svg_content_open' && t.meta && t.meta.marpitBackground) { | ||
} = t.meta.marpitBackground; | ||
open.attrSet('data-marpit-advanced-background', 'content'); // Aligned direction | ||
open.attrSet('data-marpit-advanced-background', 'content'); | ||
const direction = t.meta.marpitBackground.direction || 'horizontal'; // Split backgrounds | ||
// Aligned direction | ||
const direction = t.meta.marpitBackground.direction || 'horizontal'; | ||
// Split backgrounds | ||
const splitSide = t.meta.marpitBackground.split; | ||
if (splitSide) { | ||
@@ -59,10 +54,12 @@ open.attrSet('data-marpit-advanced-background-split', splitSide); | ||
open.attrSet('style', style.toString()); | ||
} // Add the isolated layer for background image | ||
} | ||
newTokens.push(...(0, _wrap_tokens.default)(state.Token, 'marpit_advanced_background_foreign_object', { | ||
// Add the isolated layer for background image | ||
newTokens.push(...(0, _wrap_tokens.wrapTokens)(state.Token, 'marpit_advanced_background_foreign_object', { | ||
tag: 'foreignObject', | ||
width, | ||
height | ||
}, (0, _wrap_tokens.default)(state.Token, 'marpit_advanced_background_section', { ...open.attrs.reduce((o, [k, v]) => ({ ...o, | ||
}, (0, _wrap_tokens.wrapTokens)(state.Token, 'marpit_advanced_background_section', { | ||
...open.attrs.reduce((o, [k, v]) => ({ | ||
...o, | ||
[k]: v | ||
@@ -73,3 +70,3 @@ }), {}), | ||
'data-marpit-advanced-background': 'background' | ||
}, (0, _wrap_tokens.default)(state.Token, 'marpit_advanced_background_image_container', { | ||
}, (0, _wrap_tokens.wrapTokens)(state.Token, 'marpit_advanced_background_image_container', { | ||
tag: 'div', | ||
@@ -79,13 +76,16 @@ 'data-marpit-advanced-background-container': true, | ||
}, (() => { | ||
const imageTokens = []; // Add multiple image elements | ||
const imageTokens = []; | ||
// Add multiple image elements | ||
for (const img of images) { | ||
const style = new _inline_style.default({ | ||
'background-image': `url("${img.url}")` | ||
}); // Image sizing | ||
}); | ||
if (img.size) style.set('background-size', img.size); // Image filter for backgrounds (Only in advanced BG) | ||
// Image sizing | ||
if (img.size) style.set('background-size', img.size); | ||
// Image filter for backgrounds (Only in advanced BG) | ||
if (img.filter) style.set('filter', img.filter); | ||
imageTokens.push(...(0, _wrap_tokens.default)(state.Token, 'marpit_advanced_background_image', { | ||
imageTokens.push(...(0, _wrap_tokens.wrapTokens)(state.Token, 'marpit_advanced_background_image', { | ||
tag: 'figure', | ||
@@ -95,3 +95,2 @@ style: style.toString() | ||
} | ||
return imageTokens; | ||
@@ -104,8 +103,10 @@ })()))), t); | ||
width | ||
} = current.meta.marpitBackground; // Apply styles | ||
} = current.meta.marpitBackground; | ||
// Apply styles | ||
const style = new _inline_style.default(); | ||
if (open.meta && open.meta.marpitDirectives && open.meta.marpitDirectives.color) style.set('color', open.meta.marpitDirectives.color); // Add the isolated layer for pseudo contents (e.g. Page number) | ||
if (open.meta && open.meta.marpitDirectives && open.meta.marpitDirectives.color) style.set('color', open.meta.marpitDirectives.color); | ||
newTokens.push(t, ...(0, _wrap_tokens.default)(state.Token, 'marpit_advanced_background_foreign_object', { | ||
// Add the isolated layer for pseudo contents (e.g. Page number) | ||
newTokens.push(t, ...(0, _wrap_tokens.wrapTokens)(state.Token, 'marpit_advanced_background_foreign_object', { | ||
tag: 'foreignObject', | ||
@@ -115,3 +116,5 @@ width, | ||
'data-marpit-advanced-background': 'pseudo' | ||
}, (0, _wrap_tokens.default)(state.Token, 'marpit_advanced_pseudo_section', { ...open.attrs.reduce((o, [k, v]) => ({ ...o, | ||
}, (0, _wrap_tokens.wrapTokens)(state.Token, 'marpit_advanced_pseudo_section', { | ||
...open.attrs.reduce((o, [k, v]) => ({ | ||
...o, | ||
[k]: v | ||
@@ -129,9 +132,8 @@ }), {}), | ||
} | ||
state.tokens = newTokens; | ||
}); | ||
} | ||
var _default = (0, _plugin.default)(advancedBackground); | ||
const advancedBackground = (0, _plugin.default)(_advancedBackground); | ||
exports.advancedBackground = advancedBackground; | ||
var _default = advancedBackground; | ||
exports.default = _default; |
@@ -6,8 +6,5 @@ "use strict"; | ||
}); | ||
exports.default = void 0; | ||
exports.default = exports.backgroundImageApply = void 0; | ||
var _plugin = _interopRequireDefault(require("../../plugin")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/** @module */ | ||
@@ -23,6 +20,6 @@ | ||
* | ||
* @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', ({ | ||
@@ -34,7 +31,5 @@ inlineMode, | ||
let current = {}; | ||
for (const tb of tokens) { | ||
if (tb.type === 'marpit_slide_open') current.open = tb; | ||
if (tb.type === 'marpit_inline_svg_content_open') current.svgContent = tb; | ||
if (tb.type === 'marpit_slide_close') { | ||
@@ -44,3 +39,4 @@ if (current.images && current.images.length > 0) { | ||
// Reshape meta for advanced background | ||
current.svgContent.meta = { ...(current.svgContent.meta || {}), | ||
current.svgContent.meta = { | ||
...(current.svgContent.meta || {}), | ||
marpitBackground: { | ||
@@ -59,3 +55,4 @@ direction: current.direction, | ||
const img = current.images[current.images.length - 1]; | ||
current.open.meta.marpitDirectives = { ...(current.open.meta.marpitDirectives || {}), | ||
current.open.meta.marpitDirectives = { | ||
...(current.open.meta.marpitDirectives || {}), | ||
backgroundImage: `url("${img.url}")` | ||
@@ -66,7 +63,6 @@ }; | ||
} | ||
current = {}; | ||
} // Collect parsed inline image meta | ||
} | ||
// Collect parsed inline image meta | ||
if (current.open && tb.type === 'inline') for (const t of tb.children) { | ||
@@ -87,7 +83,7 @@ if (t.type === 'image') { | ||
} = t.meta.marpitImage; | ||
if (background && !url.match(/^\s*$/)) { | ||
if (color) { | ||
// Background color | ||
current.open.meta.marpitDirectives = { ...(current.open.meta.marpitDirectives || {}), | ||
current.open.meta.marpitDirectives = { | ||
...(current.open.meta.marpitDirectives || {}), | ||
backgroundColor: color | ||
@@ -109,3 +105,2 @@ }; | ||
} | ||
if (backgroundDirection) current.direction = backgroundDirection; | ||
@@ -119,5 +114,5 @@ if (backgroundSplit) current.split = backgroundSplit; | ||
} | ||
var _default = (0, _plugin.default)(backgroundImageApply); | ||
const backgroundImageApply = (0, _plugin.default)(_backgroundImageApply); | ||
exports.backgroundImageApply = backgroundImageApply; | ||
var _default = backgroundImageApply; | ||
exports.default = _default; |
@@ -6,9 +6,7 @@ "use strict"; | ||
}); | ||
exports.default = void 0; | ||
exports.default = exports.backgroundImageParse = void 0; | ||
var _plugin = _interopRequireDefault(require("../../plugin")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/** @module */ | ||
/** @module */ | ||
const bgSizeKeywords = { | ||
@@ -21,2 +19,3 @@ auto: 'auto', | ||
const splitSizeMatcher = /^(left|right)(?::((?:\d*\.)?\d+%))?$/; | ||
/** | ||
@@ -30,7 +29,6 @@ * Marpit background image parse plugin. | ||
* | ||
* @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', ({ | ||
@@ -44,21 +42,20 @@ tokens | ||
} = t.meta; | ||
if (marpitImage.options.some(v => !v.consumed && v.content === 'bg')) { | ||
marpitImage.background = true; | ||
t.hidden = true; | ||
for (const opt of marpitImage.options) { | ||
if (opt.consumed) continue; | ||
let consumed = false; // bg keyword | ||
let consumed = false; | ||
if (opt.content === 'bg') consumed = true; // Background size keyword | ||
// bg keyword | ||
if (opt.content === 'bg') consumed = true; | ||
// Background size keyword | ||
if (bgSizeKeywords[opt.content]) { | ||
marpitImage.backgroundSize = bgSizeKeywords[opt.content]; | ||
consumed = true; | ||
} // Split background keyword | ||
} | ||
// Split background keyword | ||
const matched = opt.content.match(splitSizeMatcher); | ||
if (matched) { | ||
@@ -69,5 +66,5 @@ const [, splitSide, splitSize] = matched; | ||
consumed = true; | ||
} // Background aligned direction | ||
} | ||
// Background aligned direction | ||
if (opt.content === 'vertical' || opt.content === 'horizontal') { | ||
@@ -77,3 +74,2 @@ marpitImage.backgroundDirection = opt.content; | ||
} | ||
if (consumed) opt.consumed = true; | ||
@@ -86,5 +82,5 @@ } | ||
} | ||
var _default = (0, _plugin.default)(backgroundImageParse); | ||
const backgroundImageParse = (0, _plugin.default)(_backgroundImageParse); | ||
exports.backgroundImageParse = backgroundImageParse; | ||
var _default = backgroundImageParse; | ||
exports.default = _default; |
@@ -6,8 +6,5 @@ "use strict"; | ||
}); | ||
exports.default = void 0; | ||
exports.default = exports.collect = void 0; | ||
var _plugin = _interopRequireDefault(require("../plugin")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/** @module */ | ||
@@ -23,6 +20,6 @@ | ||
* | ||
* @alias module:markdown/collect | ||
* @function collect | ||
* @param {MarkdownIt} md markdown-it instance. | ||
*/ | ||
function collect(md) { | ||
function _collect(md) { | ||
const { | ||
@@ -37,9 +34,6 @@ marpit | ||
let pageIdx = -1; | ||
const collectComment = token => { | ||
if (currentPage >= 0 && !(token.meta && token.meta.marpitCommentParsed !== undefined)) marpit.lastComments[currentPage].push(token.content); | ||
}; | ||
const collectable = () => currentPage >= 0 && marpit.lastSlideTokens[currentPage] !== undefined; | ||
for (const token of state.tokens) { | ||
@@ -49,3 +43,2 @@ if (token.meta && token.meta.marpitSlideElement === 1) { | ||
currentPage = pageIdx; | ||
if (marpit.lastSlideTokens[currentPage] === undefined) { | ||
@@ -60,3 +53,2 @@ marpit.lastSlideTokens[currentPage] = [token]; | ||
if (collectable()) marpit.lastSlideTokens[currentPage].push(token); | ||
if (token.type === 'marpit_comment') { | ||
@@ -71,5 +63,5 @@ collectComment(token); | ||
} | ||
var _default = (0, _plugin.default)(collect); | ||
const collect = (0, _plugin.default)(_collect); | ||
exports.collect = collect; | ||
var _default = collect; | ||
exports.default = _default; |
@@ -6,20 +6,19 @@ "use strict"; | ||
}); | ||
exports.default = void 0; | ||
exports.default = exports.comment = void 0; | ||
exports.markAsParsed = markAsParsed; | ||
var _plugin = _interopRequireDefault(require("../plugin")); | ||
var _yaml = _interopRequireDefault(require("./directives/yaml")); | ||
var _yaml = require("./directives/yaml"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/** @module */ | ||
/** @module */ | ||
const commentMatcher = /<!--+\s*([\s\S]*?)\s*--+>/; | ||
const commentMatcherOpening = /^<!--/; | ||
const commentMatcherClosing = /-->/; | ||
const magicCommentMatchers = [// Prettier | ||
/^prettier-ignore(-(start|end))?$/, // markdownlint | ||
/^markdownlint-((disable|enable).*|capture|restore)$/, // remark-lint (remark-message-control) | ||
const magicCommentMatchers = [ | ||
// Prettier | ||
/^prettier-ignore(-(start|end))?$/, | ||
// markdownlint | ||
/^markdownlint-((disable|enable).*|capture|restore)$/, | ||
// remark-lint (remark-message-control) | ||
/^lint (disable|enable|ignore).*$/]; | ||
function markAsParsed(token, kind) { | ||
@@ -29,2 +28,3 @@ token.meta = token.meta || {}; | ||
} | ||
/** | ||
@@ -36,13 +36,12 @@ * Marpit comment plugin. | ||
* | ||
* @alias module:markdown/comment | ||
* @function comment | ||
* @param {MarkdownIt} md markdown-it instance. | ||
*/ | ||
function comment(md) { | ||
function _comment(md) { | ||
const parse = (token, content) => { | ||
const parsed = (0, _yaml.default)(content, !!md.marpit.options.looseYAML); | ||
const parsed = (0, _yaml.yaml)(content, !!md.marpit.options.looseYAML); | ||
token.meta = token.meta || {}; | ||
token.meta.marpitParsedDirectives = parsed === false ? {} : parsed; // Mark well-known magic comments as parsed comment | ||
token.meta.marpitParsedDirectives = parsed === false ? {} : parsed; | ||
// Mark well-known magic comments as parsed comment | ||
for (const magicCommentMatcher of magicCommentMatchers) { | ||
@@ -55,3 +54,2 @@ if (magicCommentMatcher.test(content.trim())) { | ||
}; | ||
md.block.ruler.before('html_block', 'marpit_comment', (state, startLine, endLine, silent) => { | ||
@@ -62,9 +60,10 @@ // Fast fail | ||
let max = state.eMarks[startLine]; | ||
let line = state.src.slice(pos, max); // Match to opening element | ||
let line = state.src.slice(pos, max); | ||
// Match to opening element | ||
if (!commentMatcherOpening.test(line)) return false; | ||
if (silent) return true; // Parse ending element | ||
if (silent) return true; | ||
// Parse ending element | ||
let nextLine = startLine + 1; | ||
if (!commentMatcherClosing.test(line)) { | ||
@@ -80,5 +79,5 @@ while (nextLine < endLine) { | ||
} | ||
state.line = nextLine; | ||
state.line = nextLine; // Create token | ||
// Create token | ||
const token = state.push('marpit_comment', '', 0); | ||
@@ -97,8 +96,8 @@ token.map = [startLine, nextLine]; | ||
src | ||
} = state; // Quick fail by checking `<` and `!` | ||
} = state; | ||
// Quick fail by checking `<` and `!` | ||
if (state.pos + 2 >= posMax || src.charCodeAt(state.pos) !== 0x3c || src.charCodeAt(state.pos + 1) !== 0x21) return false; | ||
const match = src.slice(state.pos).match(commentMatcher); | ||
if (!match) return false; | ||
if (!silent) { | ||
@@ -111,3 +110,2 @@ const token = state.push('marpit_comment', '', 0); | ||
} | ||
state.pos += match[0].length; | ||
@@ -117,5 +115,5 @@ return true; | ||
} | ||
var _default = (0, _plugin.default)(comment); | ||
const comment = (0, _plugin.default)(_comment); | ||
exports.comment = comment; | ||
var _default = comment; | ||
exports.default = _default; |
@@ -6,12 +6,7 @@ "use strict"; | ||
}); | ||
exports.default = void 0; | ||
var _wrap_array = _interopRequireDefault(require("../helpers/wrap_array")); | ||
var _wrap_tokens = _interopRequireDefault(require("../helpers/wrap_tokens")); | ||
exports.default = exports.container = void 0; | ||
var _wrap_array = require("../helpers/wrap_array"); | ||
var _wrap_tokens = require("../helpers/wrap_tokens"); | ||
var _plugin = _interopRequireDefault(require("../plugin")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/** @module */ | ||
@@ -22,7 +17,7 @@ | ||
* | ||
* @alias module:markdown/container | ||
* @function container | ||
* @param {MarkdownIt} md markdown-it instance. | ||
*/ | ||
function container(md) { | ||
const containers = (0, _wrap_array.default)(md.marpit.options.container); | ||
function _container(md) { | ||
const containers = (0, _wrap_array.wrapArray)(md.marpit.options.container); | ||
if (!containers) return; | ||
@@ -32,9 +27,8 @@ const target = [...containers].reverse(); | ||
if (state.inlineMode) return; | ||
for (const cont of target) state.tokens = (0, _wrap_tokens.default)(state.Token, 'marpit_containers', cont, state.tokens); | ||
for (const cont of target) state.tokens = (0, _wrap_tokens.wrapTokens)(state.Token, 'marpit_containers', cont, state.tokens); | ||
}); | ||
} | ||
var _default = (0, _plugin.default)(container); | ||
const container = (0, _plugin.default)(_container); | ||
exports.container = container; | ||
var _default = container; | ||
exports.default = _default; |
@@ -6,14 +6,8 @@ "use strict"; | ||
}); | ||
exports.default = void 0; | ||
exports.default = exports.apply = void 0; | ||
var _lodash = _interopRequireDefault(require("lodash.kebabcase")); | ||
var _inline_style = _interopRequireDefault(require("../../helpers/inline_style")); | ||
var _plugin = _interopRequireDefault(require("../../plugin")); | ||
var _directives = _interopRequireDefault(require("./directives")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/** @module */ | ||
@@ -24,3 +18,3 @@ | ||
* | ||
* @alias module:markdown/directives/apply | ||
* @function apply | ||
* @param {MarkdownIt} md markdown-it instance. | ||
@@ -33,3 +27,3 @@ * @param {Object} [opts] | ||
*/ | ||
function apply(md, opts = {}) { | ||
function _apply(md, opts = {}) { | ||
const { | ||
@@ -47,3 +41,2 @@ marpit | ||
if (state.inlineMode) return; | ||
for (const token of state.tokens) { | ||
@@ -55,10 +48,7 @@ const { | ||
} = token.meta || {}; | ||
if (marpitDirectives) { | ||
const style = new _inline_style.default(token.attrGet('style')); | ||
for (const dir of Object.keys(marpitDirectives)) { | ||
if (directives.includes(dir)) { | ||
const value = marpitDirectives[dir]; | ||
if (value) { | ||
@@ -70,9 +60,8 @@ const kebabCaseDir = (0, _lodash.default)(dir); | ||
} | ||
} // Apply attribute to token | ||
} | ||
// Apply attribute to token | ||
if (marpitDirectives.class) token.attrJoin('class', marpitDirectives.class); | ||
if (marpitDirectives.color) style.set('color', marpitDirectives.color); | ||
if (marpitDirectives.backgroundColor) style.set('background-color', marpitDirectives.backgroundColor).set('background-image', 'none'); | ||
if (marpitDirectives.backgroundImage) { | ||
@@ -84,3 +73,2 @@ style.set('background-image', marpitDirectives.backgroundImage).set('background-position', 'center').set('background-repeat', 'no-repeat').set('background-size', 'cover'); | ||
} | ||
if (marpitDirectives.paginate) { | ||
@@ -90,3 +78,2 @@ token.attrSet('data-marpit-pagination', marpitSlide + 1); | ||
} | ||
if (marpitDirectives.header) token.meta.marpitHeader = marpitDirectives.header; | ||
@@ -100,5 +87,5 @@ if (marpitDirectives.footer) token.meta.marpitFooter = marpitDirectives.footer; | ||
} | ||
var _default = (0, _plugin.default)(apply); | ||
const apply = (0, _plugin.default)(_apply); | ||
exports.apply = apply; | ||
var _default = apply; | ||
exports.default = _default; |
@@ -7,3 +7,2 @@ "use strict"; | ||
exports.locals = exports.globals = exports.default = void 0; | ||
/** | ||
@@ -34,7 +33,4 @@ * The definition of Marpit directives | ||
const headings = [1, 2, 3, 4, 5, 6]; | ||
const toInt = v => Array.isArray(v) || Number.isNaN(v) ? v : Number.parseInt(v, 10); | ||
const converted = toInt(value); | ||
if (Array.isArray(converted)) { | ||
@@ -46,3 +42,2 @@ const convertedArr = converted.map(toInt); | ||
} | ||
if (value === 'false') return { | ||
@@ -63,2 +58,3 @@ headingDivider: false | ||
}); | ||
/** | ||
@@ -89,3 +85,2 @@ * Local directives. | ||
*/ | ||
exports.globals = globals; | ||
@@ -92,0 +87,0 @@ const locals = Object.assign(Object.create(null), { |
@@ -6,22 +6,15 @@ "use strict"; | ||
}); | ||
exports.default = void 0; | ||
exports.parse = exports.default = void 0; | ||
var _markdownItFrontMatter = _interopRequireDefault(require("markdown-it-front-matter")); | ||
var _plugin = _interopRequireDefault(require("../../plugin")); | ||
var _comment = require("../comment"); | ||
var directives = _interopRequireWildcard(require("./directives")); | ||
var _yaml = _interopRequireDefault(require("./yaml")); | ||
var _yaml = require("./yaml"); | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/** @module */ | ||
/** @module */ | ||
const isDirectiveComment = token => token.type === 'marpit_comment' && token.meta.marpitParsedDirectives; | ||
/** | ||
@@ -33,3 +26,3 @@ * Parse Marpit directives and store result to the slide token meta. | ||
* | ||
* @alias module:markdown/directives/parse | ||
* @function parse | ||
* @param {MarkdownIt} md markdown-it instance. | ||
@@ -41,15 +34,12 @@ * @param {Object} [opts] | ||
*/ | ||
function parse(md, opts = {}) { | ||
function _parse(md, opts = {}) { | ||
const { | ||
marpit | ||
} = md; | ||
const applyBuiltinDirectives = (newProps, builtinDirectives) => { | ||
let ret = {}; | ||
for (const prop of Object.keys(newProps)) { | ||
if (builtinDirectives[prop]) { | ||
ret = { ...ret, | ||
ret = { | ||
...ret, | ||
...builtinDirectives[prop](newProps[prop], marpit) | ||
@@ -61,10 +51,8 @@ }; | ||
} | ||
return ret; | ||
}; // Front-matter support | ||
}; | ||
// Front-matter support | ||
const frontMatter = opts.frontMatter === undefined ? true : !!opts.frontMatter; | ||
let frontMatterObject = {}; | ||
if (frontMatter) { | ||
@@ -77,19 +65,18 @@ md.core.ruler.before('block', 'marpit_directives_front_matter', state => { | ||
frontMatterObject.text = fm; | ||
const parsed = (0, _yaml.default)(fm, marpit.options.looseYAML ? [...Object.keys(marpit.customDirectives.global), ...Object.keys(marpit.customDirectives.local)] : false); | ||
const parsed = (0, _yaml.yaml)(fm, marpit.options.looseYAML ? [...Object.keys(marpit.customDirectives.global), ...Object.keys(marpit.customDirectives.local)] : false); | ||
if (parsed !== false) frontMatterObject.yaml = parsed; | ||
}); | ||
} // Parse global directives | ||
} | ||
// Parse global directives | ||
md.core.ruler.after('inline', 'marpit_directives_global_parse', state => { | ||
if (state.inlineMode) return; | ||
let globalDirectives = {}; | ||
const applyDirectives = obj => { | ||
let recognized = false; | ||
for (const key of Object.keys(obj)) { | ||
if (directives.globals[key]) { | ||
recognized = true; | ||
globalDirectives = { ...globalDirectives, | ||
globalDirectives = { | ||
...globalDirectives, | ||
...directives.globals[key](obj[key], marpit) | ||
@@ -99,3 +86,4 @@ }; | ||
recognized = true; | ||
globalDirectives = { ...globalDirectives, | ||
globalDirectives = { | ||
...globalDirectives, | ||
...applyBuiltinDirectives(marpit.customDirectives.global[key](obj[key], marpit), directives.globals) | ||
@@ -105,8 +93,5 @@ }; | ||
} | ||
return recognized; | ||
}; | ||
if (frontMatterObject.yaml) applyDirectives(frontMatterObject.yaml); | ||
for (const token of state.tokens) { | ||
@@ -121,7 +106,8 @@ if (isDirectiveComment(token) && applyDirectives(token.meta.marpitParsedDirectives)) { | ||
} | ||
marpit.lastGlobalDirectives = { ...globalDirectives | ||
marpit.lastGlobalDirectives = { | ||
...globalDirectives | ||
}; | ||
}); // Parse local directives and apply meta to slide | ||
}); | ||
// Parse local directives and apply meta to slide | ||
md.core.ruler.after('marpit_slide', 'marpit_directives_parse', state => { | ||
@@ -135,10 +121,9 @@ if (state.inlineMode) return; | ||
}; | ||
const applyDirectives = obj => { | ||
let recognized = false; | ||
for (const key of Object.keys(obj)) { | ||
if (directives.locals[key]) { | ||
recognized = true; | ||
cursor.local = { ...cursor.local, | ||
cursor.local = { | ||
...cursor.local, | ||
...directives.locals[key](obj[key], marpit) | ||
@@ -148,15 +133,16 @@ }; | ||
recognized = true; | ||
cursor.local = { ...cursor.local, | ||
cursor.local = { | ||
...cursor.local, | ||
...applyBuiltinDirectives(marpit.customDirectives.local[key](obj[key], marpit), directives.locals) | ||
}; | ||
} // Spot directives | ||
} | ||
// Spot directives | ||
// (Apply local directive to only current slide by prefix "_") | ||
if (key.startsWith('_')) { | ||
const spotKey = key.slice(1); | ||
if (directives.locals[spotKey]) { | ||
recognized = true; | ||
cursor.spot = { ...cursor.spot, | ||
cursor.spot = { | ||
...cursor.spot, | ||
...directives.locals[spotKey](obj[key], marpit) | ||
@@ -166,3 +152,4 @@ }; | ||
recognized = true; | ||
cursor.spot = { ...cursor.spot, | ||
cursor.spot = { | ||
...cursor.spot, | ||
...applyBuiltinDirectives(marpit.customDirectives.local[spotKey](obj[key], marpit), directives.locals) | ||
@@ -173,8 +160,5 @@ }; | ||
} | ||
return recognized; | ||
}; | ||
if (frontMatterObject.yaml) applyDirectives(frontMatterObject.yaml); | ||
for (const token of state.tokens) { | ||
@@ -188,3 +172,4 @@ if (token.meta && token.meta.marpitSlideElement === 1) { | ||
// Assign local and spot directives to meta | ||
cursor.slide.meta.marpitDirectives = { ...cursor.slide.meta.marpitDirectives, | ||
cursor.slide.meta.marpitDirectives = { | ||
...cursor.slide.meta.marpitDirectives, | ||
...cursor.local, | ||
@@ -201,6 +186,7 @@ ...cursor.spot | ||
} | ||
} // Assign global directives to meta | ||
} | ||
for (const token of slides) token.meta.marpitDirectives = { ...token.meta.marpitDirectives, | ||
// Assign global directives to meta | ||
for (const token of slides) token.meta.marpitDirectives = { | ||
...token.meta.marpitDirectives, | ||
...marpit.lastGlobalDirectives | ||
@@ -210,5 +196,5 @@ }; | ||
} | ||
var _default = (0, _plugin.default)(parse); | ||
const parse = (0, _plugin.default)(_parse); | ||
exports.parse = parse; | ||
var _default = parse; | ||
exports.default = _default; |
@@ -6,18 +6,12 @@ "use strict"; | ||
}); | ||
exports.default = void 0; | ||
exports.yaml = exports.default = void 0; | ||
var _jsYaml = _interopRequireWildcard(require("js-yaml")); | ||
var _directives = _interopRequireDefault(require("./directives")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
/** @module */ | ||
/** @module */ | ||
const createPatterns = keys => { | ||
const set = new Set(); | ||
for (const k of keys) { | ||
@@ -29,8 +23,5 @@ const normalized = '_?' + k.replace(/[.*+?^=!:${}()|[\]\\/]/g, '\\$&'); | ||
} | ||
return [...set.values()]; | ||
}; | ||
const yamlSpecialChars = `["'{|>~&*`; | ||
function parse(text) { | ||
@@ -41,3 +32,2 @@ try { | ||
}); | ||
if (obj === null || typeof obj !== 'object') return false; | ||
@@ -49,3 +39,2 @@ return obj; | ||
} | ||
function convertLoose(text, looseDirectives) { | ||
@@ -55,3 +44,2 @@ const keyPattern = `(?:${createPatterns(looseDirectives).join('|')})`; | ||
let normalized = ''; | ||
for (const line of text.split(/\r?\n/)) normalized += `${line.replace(looseMatcher, (original, prop, value) => { | ||
@@ -64,9 +52,9 @@ const trimmed = value.trim(); | ||
})}\n`; | ||
return normalized.trim(); | ||
} | ||
/** | ||
* Parse text as YAML by using js-yaml's FAILSAFE_SCHEMA. | ||
* | ||
* @alias module:markdown/directives/yaml | ||
* @function yaml | ||
* @param {String} text Target text. | ||
@@ -80,5 +68,5 @@ * @param {boolean|string[]} [looseDirectives=false] By setting `true`, it try | ||
var _default = (text, looseDirectives = false) => parse(looseDirectives ? convertLoose(text, [..._directives.default, ...(Array.isArray(looseDirectives) ? looseDirectives : [])]) : text); | ||
const yaml = (text, looseDirectives = false) => parse(looseDirectives ? convertLoose(text, [..._directives.default, ...(Array.isArray(looseDirectives) ? looseDirectives : [])]) : text); | ||
exports.yaml = yaml; | ||
var _default = yaml; | ||
exports.default = _default; |
@@ -6,22 +6,19 @@ "use strict"; | ||
}); | ||
exports.default = void 0; | ||
exports.fragment = exports.default = void 0; | ||
var _plugin = _interopRequireDefault(require("../plugin")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/** @module */ | ||
/** @module */ | ||
const fragmentedListMarkups = ['*', ')']; | ||
/** | ||
* Marpit fragment plugin. | ||
* | ||
* @alias module:markdown/fragment | ||
* @function fragment | ||
* @param {MarkdownIt} md markdown-it instance. | ||
*/ | ||
function fragment(md) { | ||
function _fragment(md) { | ||
// Fragmented list | ||
md.core.ruler.after('marpit_directives_parse', 'marpit_fragment', state => { | ||
if (state.inlineMode) return; | ||
for (const token of state.tokens) { | ||
@@ -33,4 +30,5 @@ if (token.type === 'list_item_open' && fragmentedListMarkups.includes(token.markup)) { | ||
} | ||
}); // Add data-marpit-fragment(s) attributes to token | ||
}); | ||
// Add data-marpit-fragment(s) attributes to token | ||
md.core.ruler.after('marpit_fragment', 'marpit_apply_fragment', state => { | ||
@@ -42,3 +40,2 @@ if (state.inlineMode) return; | ||
}; | ||
for (const token of state.tokens) { | ||
@@ -60,5 +57,5 @@ if (token.meta && token.meta.marpitSlideElement === 1) { | ||
} | ||
var _default = (0, _plugin.default)(fragment); | ||
const fragment = (0, _plugin.default)(_fragment); | ||
exports.fragment = fragment; | ||
var _default = fragment; | ||
exports.default = _default; |
@@ -6,10 +6,6 @@ "use strict"; | ||
}); | ||
exports.default = void 0; | ||
var _wrap_tokens = _interopRequireDefault(require("../helpers/wrap_tokens")); | ||
exports.headerAndFooter = exports.default = void 0; | ||
var _wrap_tokens = require("../helpers/wrap_tokens"); | ||
var _plugin = _interopRequireDefault(require("../plugin")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/** @module */ | ||
@@ -22,13 +18,11 @@ | ||
* | ||
* @alias module:markdown/header_and_footer | ||
* @function headerAndFooter | ||
* @param {MarkdownIt} md markdown-it instance. | ||
*/ | ||
function headerAndFooter(md) { | ||
function _headerAndFooter(md) { | ||
md.core.ruler.after('marpit_directives_apply', 'marpit_header_and_footer', state => { | ||
if (state.inlineMode) return; | ||
const parsedInlines = new Map(); | ||
const getParsed = markdown => { | ||
let parsed = parsedInlines.get(markdown); | ||
if (!parsed) { | ||
@@ -39,7 +33,5 @@ parsed = md.parseInline(markdown, state.env); | ||
} | ||
return parsed; | ||
}; | ||
const createMarginalTokens = (tag, markdown) => (0, _wrap_tokens.default)(state.Token, `marpit_${tag}`, { | ||
const createMarginalTokens = (tag, markdown) => (0, _wrap_tokens.wrapTokens)(state.Token, `marpit_${tag}`, { | ||
tag, | ||
@@ -50,6 +42,4 @@ close: { | ||
}, getParsed(markdown)); | ||
let current; | ||
const newTokens = []; | ||
for (const token of state.tokens) { | ||
@@ -67,9 +57,8 @@ if (token.type === 'marpit_slide_open') { | ||
} | ||
state.tokens = newTokens; | ||
}); | ||
} | ||
var _default = (0, _plugin.default)(headerAndFooter); | ||
const headerAndFooter = (0, _plugin.default)(_headerAndFooter); | ||
exports.headerAndFooter = headerAndFooter; | ||
var _default = headerAndFooter; | ||
exports.default = _default; |
@@ -6,10 +6,6 @@ "use strict"; | ||
}); | ||
exports.default = void 0; | ||
var _split = _interopRequireDefault(require("../helpers/split")); | ||
exports.headingDivider = exports.default = void 0; | ||
var _split = require("../helpers/split"); | ||
var _plugin = _interopRequireDefault(require("../plugin")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/** @module */ | ||
@@ -23,6 +19,6 @@ | ||
* | ||
* @alias module:markdown/heading_divider | ||
* @function headingDivider | ||
* @param {MarkdownIt} md markdown-it instance. | ||
*/ | ||
function headingDivider(md) { | ||
function _headingDivider(md) { | ||
const { | ||
@@ -38,10 +34,6 @@ marpit | ||
const splitTag = target.map(i => `h${i}`); | ||
const splitFunc = t => t.type === 'heading_open' && splitTag.includes(t.tag); | ||
const newTokens = []; | ||
for (const slideTokens of (0, _split.default)(state.tokens, splitFunc, true)) { | ||
for (const slideTokens of (0, _split.split)(state.tokens, splitFunc, true)) { | ||
const [token] = slideTokens; | ||
if (token && splitFunc(token) && newTokens.some(t => !t.hidden)) { | ||
@@ -53,12 +45,10 @@ const hr = new state.Token('hr', '', 0); | ||
} | ||
newTokens.push(...slideTokens); | ||
} | ||
state.tokens = newTokens; | ||
}); | ||
} | ||
var _default = (0, _plugin.default)(headingDivider); | ||
const headingDivider = (0, _plugin.default)(_headingDivider); | ||
exports.headingDivider = headingDivider; | ||
var _default = headingDivider; | ||
exports.default = _default; |
@@ -6,12 +6,7 @@ "use strict"; | ||
}); | ||
exports.default = void 0; | ||
exports.image = exports.default = void 0; | ||
var _plugin = _interopRequireDefault(require("../plugin")); | ||
var _apply = _interopRequireDefault(require("./image/apply")); | ||
var _parse = _interopRequireDefault(require("./image/parse")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/** @module */ | ||
@@ -22,12 +17,12 @@ | ||
* | ||
* @alias module:markdown/image | ||
* @function image | ||
* @param {MarkdownIt} md markdown-it instance. | ||
*/ | ||
function image(md) { | ||
function _image(md) { | ||
(0, _parse.default)(md); | ||
(0, _apply.default)(md); | ||
} | ||
var _default = (0, _plugin.default)(image); | ||
const image = (0, _plugin.default)(_image); | ||
exports.image = image; | ||
var _default = image; | ||
exports.default = _default; |
@@ -6,10 +6,6 @@ "use strict"; | ||
}); | ||
exports.default = void 0; | ||
exports.default = exports.applyImage = void 0; | ||
var _inline_style = _interopRequireDefault(require("../../helpers/inline_style")); | ||
var _plugin = _interopRequireDefault(require("../../plugin")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/** @module */ | ||
@@ -22,6 +18,6 @@ | ||
* | ||
* @alias module:markdown/image/apply | ||
* @function applyImage | ||
* @param {MarkdownIt} md markdown-it instance. | ||
*/ | ||
function applyImage(md) { | ||
function _applyImage(md) { | ||
// Build and apply image style | ||
@@ -41,12 +37,8 @@ md.inline.ruler2.push('marpit_apply_image', ({ | ||
if (height && !height.endsWith('%')) style.set('height', height); | ||
if (filters) { | ||
const filterStyle = []; | ||
for (const fltrs of filters) filterStyle.push(`${fltrs[0]}(${fltrs[1]})`); | ||
token.meta.marpitImage.filter = filterStyle.join(' '); | ||
style.set('filter', token.meta.marpitImage.filter); | ||
} | ||
const stringified = style.toString(); | ||
@@ -56,4 +48,5 @@ if (stringified) token.attrSet('style', stringified); | ||
} | ||
}); // [DEPRECATED] Shorthand for color spot directive | ||
}); | ||
// [DEPRECATED] Shorthand for color spot directive | ||
md.core.ruler.after('marpit_inline_svg', 'marpit_apply_color', ({ | ||
@@ -65,7 +58,7 @@ inlineMode, | ||
let current; | ||
for (const t of tokens) { | ||
if (t.type === 'marpit_slide_open') current = t; | ||
if (t.type === 'marpit_slide_close') current = undefined; // Collect parsed inline image meta | ||
if (t.type === 'marpit_slide_close') current = undefined; | ||
// Collect parsed inline image meta | ||
if (current && t.type === 'inline') { | ||
@@ -78,5 +71,5 @@ for (const tc of t.children) { | ||
} = tc.meta.marpitImage; | ||
if (!background && color) { | ||
current.meta.marpitDirectives = { ...(current.meta.marpitDirectives || {}), | ||
current.meta.marpitDirectives = { | ||
...(current.meta.marpitDirectives || {}), | ||
color | ||
@@ -91,5 +84,5 @@ }; | ||
} | ||
var _default = (0, _plugin.default)(applyImage); | ||
const applyImage = (0, _plugin.default)(_applyImage); | ||
exports.applyImage = applyImage; | ||
var _default = applyImage; | ||
exports.default = _default; |
@@ -6,21 +6,18 @@ "use strict"; | ||
}); | ||
exports.default = void 0; | ||
exports.parseImage = exports.default = void 0; | ||
var _colorString = _interopRequireDefault(require("color-string")); | ||
var _plugin = _interopRequireDefault(require("../../plugin")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/** @module */ | ||
/** @module */ | ||
const escape = target => target.replace(/[\\;:()]/g, matched => `\\${matched[0].codePointAt(0).toString(16)} `); | ||
const optionMatchers = new Map(); | ||
const optionMatchers = new Map(); // The scale percentage for resize background | ||
// The scale percentage for resize background | ||
optionMatchers.set(/^(\d*\.)?\d+%$/, matches => ({ | ||
size: matches[0] | ||
})); // width and height | ||
})); | ||
// width and height | ||
const normalizeLength = v => `${v}${/^(\d*\.)?\d+$/.test(v) ? 'px' : ''}`; | ||
optionMatchers.set(/^w(?:idth)?:((?:\d*\.)?\d+(?:%|ch|cm|em|ex|in|mm|pc|pt|px)?|auto)$/, matches => ({ | ||
@@ -31,4 +28,5 @@ width: normalizeLength(matches[1]) | ||
height: normalizeLength(matches[1]) | ||
})); // CSS filters | ||
})); | ||
// CSS filters | ||
optionMatchers.set(/^blur(?::(.+))?$/, (matches, meta) => ({ | ||
@@ -45,3 +43,2 @@ filters: [...meta.filters, ['blur', escape(matches[1] || '10px')]] | ||
const args = []; | ||
for (const arg of matches.slice(1)) { | ||
@@ -53,3 +50,2 @@ if (arg) { | ||
} | ||
return { | ||
@@ -77,2 +73,3 @@ filters: [...meta.filters, ['drop-shadow', args.join(' ') || '0 5px 10px rgba(0,0,0,.4)']] | ||
})); | ||
/** | ||
@@ -85,15 +82,14 @@ * Marpit image parse plugin. | ||
* | ||
* @alias module:markdown/image/parse | ||
* @function parseImage | ||
* @param {MarkdownIt} md markdown-it instance. | ||
*/ | ||
function parseImage(md) { | ||
function _parseImage(md) { | ||
const { | ||
process | ||
} = md.core; // Store original URL, for the color shorthand. | ||
} = md.core; | ||
// Store original URL, for the color shorthand. | ||
// (Avoid a side effect from link normalization) | ||
let originalURLMap; | ||
let refCount = 0; | ||
const finalizeTokenAttr = (token, state) => { | ||
@@ -103,14 +99,13 @@ // Convert imprimitive attribute value into primitive string | ||
token.attrs = token.attrs.map(([name, value]) => [name, value.toString()]); | ||
} // Apply finalization recursively to inline tokens | ||
} | ||
// Apply finalization recursively to inline tokens | ||
if (token.type === 'inline') { | ||
for (const t of token.children) finalizeTokenAttr(t, state); | ||
} // Re-generate the alt text of image token to remove Marpit specific options | ||
} | ||
// Re-generate the alt text of image token to remove Marpit specific options | ||
if (token.type === 'image' && token.meta && token.meta.marpitImage) { | ||
let updatedAlt = ''; | ||
let hasConsumed = false; | ||
for (const opt of token.meta.marpitImage.options) { | ||
@@ -123,3 +118,2 @@ if (opt.consumed) { | ||
} | ||
if (hasConsumed) { | ||
@@ -132,10 +126,9 @@ let newTokens = []; | ||
}; | ||
md.core.process = state => { | ||
const { | ||
normalizeLink | ||
} = md; // Prevent reset of WeakMap caused by calling core process internally | ||
} = md; | ||
// Prevent reset of WeakMap caused by calling core process internally | ||
if (refCount === 0) originalURLMap = new WeakMap(); | ||
try { | ||
@@ -147,3 +140,2 @@ md.normalizeLink = url => { | ||
}; | ||
refCount += 1; | ||
@@ -154,3 +146,2 @@ return process.call(md.core, state); | ||
md.normalizeLink = normalizeLink; | ||
if (refCount === 0) { | ||
@@ -162,3 +153,2 @@ // Apply finalization for every tokens | ||
}; | ||
md.inline.ruler2.push('marpit_parse_image', ({ | ||
@@ -187,3 +177,2 @@ tokens | ||
} | ||
return acc; | ||
@@ -194,8 +183,10 @@ }, []); | ||
token.meta = token.meta || {}; | ||
token.meta.marpitImage = { ...(token.meta.marpitImage || {}), | ||
token.meta.marpitImage = { | ||
...(token.meta.marpitImage || {}), | ||
url: url.toString(), | ||
options | ||
}; // [DEPRECATED] | ||
}; | ||
// [DEPRECATED] | ||
// Detect shorthand for setting color (Use value before normalization) | ||
if (!!_colorString.default.get(originalUrl) || originalUrl.toLowerCase() === 'currentcolor') { | ||
@@ -206,5 +197,5 @@ const replacedDirective = options.some(opt => opt.content === 'bg') ? 'backgroundColor' : 'color'; | ||
token.hidden = true; | ||
} // Parse keyword through matchers | ||
} | ||
// Parse keyword through matchers | ||
for (const opt of options) { | ||
@@ -214,6 +205,6 @@ for (const [regexp, mergeFunc] of optionMatchers) { | ||
const matched = opt.content.match(regexp); | ||
if (matched) { | ||
opt.consumed = true; | ||
token.meta.marpitImage = { ...token.meta.marpitImage, | ||
token.meta.marpitImage = { | ||
...token.meta.marpitImage, | ||
...mergeFunc(matched, { | ||
@@ -231,5 +222,5 @@ filters: [], | ||
} | ||
var _default = (0, _plugin.default)(parseImage); | ||
const parseImage = (0, _plugin.default)(_parseImage); | ||
exports.parseImage = parseImage; | ||
var _default = parseImage; | ||
exports.default = _default; |
@@ -6,12 +6,7 @@ "use strict"; | ||
}); | ||
exports.default = void 0; | ||
var _split = _interopRequireDefault(require("../helpers/split")); | ||
var _wrap_tokens = _interopRequireDefault(require("../helpers/wrap_tokens")); | ||
exports.inlineSVG = exports.default = void 0; | ||
var _split = require("../helpers/split"); | ||
var _wrap_tokens = require("../helpers/wrap_tokens"); | ||
var _plugin = _interopRequireDefault(require("../plugin")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/** @module */ | ||
@@ -22,6 +17,6 @@ | ||
* | ||
* @alias module:markdown/inline_svg | ||
* @function inlineSVG | ||
* @param {MarkdownIt} md markdown-it instance. | ||
*/ | ||
function inlineSVG(md) { | ||
function _inlineSVG(md) { | ||
const { | ||
@@ -39,8 +34,6 @@ marpit | ||
const newTokens = []; | ||
for (const tokens of (0, _split.default)(state.tokens, t => t.meta && t.meta.marpitSlideElement === 1, true)) { | ||
for (const tokens of (0, _split.split)(state.tokens, t => t.meta && t.meta.marpitSlideElement === 1, true)) { | ||
if (tokens.length > 0) { | ||
for (const t of tokens) if (t.meta && t.meta.marpitSlideElement) delete t.meta.marpitSlideElement; | ||
newTokens.push(...(0, _wrap_tokens.default)(state.Token, 'marpit_inline_svg', { | ||
newTokens.push(...(0, _wrap_tokens.wrapTokens)(state.Token, 'marpit_inline_svg', { | ||
tag: 'svg', | ||
@@ -59,3 +52,3 @@ 'data-marpit-svg': '', | ||
} | ||
}, (0, _wrap_tokens.default)(state.Token, 'marpit_inline_svg_content', { | ||
}, (0, _wrap_tokens.wrapTokens)(state.Token, 'marpit_inline_svg_content', { | ||
tag: 'foreignObject', | ||
@@ -67,9 +60,8 @@ width: w, | ||
} | ||
state.tokens = newTokens; | ||
}); | ||
} | ||
var _default = (0, _plugin.default)(inlineSVG); | ||
const inlineSVG = (0, _plugin.default)(_inlineSVG); | ||
exports.inlineSVG = inlineSVG; | ||
var _default = inlineSVG; | ||
exports.default = _default; |
@@ -6,14 +6,8 @@ "use strict"; | ||
}); | ||
exports.default = void 0; | ||
var _split = _interopRequireDefault(require("../helpers/split")); | ||
var _wrap_array = _interopRequireDefault(require("../helpers/wrap_array")); | ||
var _wrap_tokens = _interopRequireDefault(require("../helpers/wrap_tokens")); | ||
exports.slideContainer = exports.default = void 0; | ||
var _split = require("../helpers/split"); | ||
var _wrap_array = require("../helpers/wrap_array"); | ||
var _wrap_tokens = require("../helpers/wrap_tokens"); | ||
var _plugin = _interopRequireDefault(require("../plugin")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/** @module */ | ||
@@ -24,7 +18,7 @@ | ||
* | ||
* @alias module:markdown/slide_container | ||
* @function slideContainer | ||
* @param {MarkdownIt} md markdown-it instance. | ||
*/ | ||
function slideContainer(md) { | ||
const containers = (0, _wrap_array.default)(md.marpit.options.slideContainer); | ||
function _slideContainer(md) { | ||
const containers = (0, _wrap_array.wrapArray)(md.marpit.options.slideContainer); | ||
if (!containers) return; | ||
@@ -35,13 +29,11 @@ const target = [...containers].reverse(); | ||
const newTokens = []; | ||
for (const tokens of (0, _split.default)(state.tokens, t => t.meta && t.meta.marpitSlideElement === 1, true)) { | ||
if (tokens.length > 0) newTokens.push(...target.reduce((slides, conts) => (0, _wrap_tokens.default)(state.Token, 'marpit_slide_containers', conts, slides), tokens)); | ||
for (const tokens of (0, _split.split)(state.tokens, t => t.meta && t.meta.marpitSlideElement === 1, true)) { | ||
if (tokens.length > 0) newTokens.push(...target.reduce((slides, conts) => (0, _wrap_tokens.wrapTokens)(state.Token, 'marpit_slide_containers', conts, slides), tokens)); | ||
} | ||
state.tokens = newTokens; | ||
}); | ||
} | ||
var _default = (0, _plugin.default)(slideContainer); | ||
const slideContainer = (0, _plugin.default)(_slideContainer); | ||
exports.slideContainer = slideContainer; | ||
var _default = slideContainer; | ||
exports.default = _default; |
@@ -6,14 +6,11 @@ "use strict"; | ||
}); | ||
exports.defaultAnchorCallback = exports.default = void 0; | ||
var _split = _interopRequireDefault(require("../helpers/split")); | ||
var _wrap_tokens = _interopRequireDefault(require("../helpers/wrap_tokens")); | ||
exports.slide = exports.defaultAnchorCallback = exports.default = void 0; | ||
var _split = require("../helpers/split"); | ||
var _wrap_tokens = require("../helpers/wrap_tokens"); | ||
var _plugin = _interopRequireDefault(require("../plugin")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/** @module */ | ||
/** @module */ | ||
const defaultAnchorCallback = i => `${i + 1}`; | ||
/** | ||
@@ -25,3 +22,3 @@ * Marpit slide plugin. | ||
* | ||
* @alias module:markdown/slide | ||
* @function slide | ||
* @param {MarkdownIt} md markdown-it instance. | ||
@@ -35,9 +32,5 @@ * @param {Object} [opts] | ||
*/ | ||
exports.defaultAnchorCallback = defaultAnchorCallback; | ||
function slide(md, opts = {}) { | ||
function _slide(md, opts = {}) { | ||
const anchor = opts.anchor === undefined ? true : opts.anchor; | ||
const anchorCallback = (() => { | ||
@@ -48,6 +41,5 @@ if (typeof anchor === 'function') return anchor; | ||
})(); | ||
md.core.ruler.push('marpit_slide', state => { | ||
if (state.inlineMode) return; | ||
const splittedTokens = (0, _split.default)(state.tokens, t => t.type === 'hr' && t.level === 0, true); | ||
const splittedTokens = (0, _split.split)(state.tokens, t => t.type === 'hr' && t.level === 0, true); | ||
const { | ||
@@ -59,3 +51,4 @@ length: marpitSlideTotal | ||
const mapTarget = firstHr || slideTokens.find(t => t.map); | ||
return [...arr, ...(0, _wrap_tokens.default)(state.Token, 'marpit_slide', { ...(opts.attributes || {}), | ||
return [...arr, ...(0, _wrap_tokens.wrapTokens)(state.Token, 'marpit_slide', { | ||
...(opts.attributes || {}), | ||
tag: 'section', | ||
@@ -84,5 +77,5 @@ id: anchorCallback(marpitSlide), | ||
} | ||
var _default = (0, _plugin.default)(slide); | ||
const slide = (0, _plugin.default)(_slide); | ||
exports.slide = slide; | ||
var _default = slide; | ||
exports.default = _default; |
@@ -6,26 +6,17 @@ "use strict"; | ||
}); | ||
exports.default = void 0; | ||
exports.default = exports.assign = void 0; | ||
var _postcss = _interopRequireDefault(require("postcss")); | ||
var _postcss_plugin = _interopRequireDefault(require("../../helpers/postcss_plugin")); | ||
var _plugin = _interopRequireDefault(require("../../plugin")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/** @module */ | ||
/** @module */ | ||
const uniqKeyChars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; | ||
const uniqKeyCharsLength = uniqKeyChars.length; | ||
const generateScopeAttr = uniqKey => `data-marpit-scope-${uniqKey}`; | ||
const generateUniqKey = (length = 8) => { | ||
let ret = ''; | ||
for (let i = 0; i < length; i += 1) ret += uniqKeyChars[Math.floor(Math.random() * uniqKeyCharsLength)]; | ||
return ret; | ||
}; | ||
const injectScopePostCSSplugin = (0, _postcss_plugin.default)('marpit-style-assign-postcss-inject-scope', (key, keyframeSet) => css => css.each(function inject(node) { | ||
@@ -36,3 +27,2 @@ const { | ||
} = node; | ||
if (type === 'atrule') { | ||
@@ -59,2 +49,3 @@ if (name === 'keyframes' && node.params) { | ||
}); | ||
/** | ||
@@ -66,7 +57,6 @@ * Marpit style assign plugin. | ||
* | ||
* @alias module:markdown/style/assign | ||
* @function assign | ||
* @param {MarkdownIt} md markdown-it instance. | ||
*/ | ||
function assign(md) { | ||
function _assign(md) { | ||
const { | ||
@@ -80,3 +70,2 @@ marpit | ||
let current; | ||
for (const token of state.tokens) { | ||
@@ -91,4 +80,5 @@ if (token.meta && token.meta.marpitSlideElement === 1) { | ||
styles | ||
} = current.meta.marpitStyleScoped; // Rewrite keyframes name in animation decls | ||
} = current.meta.marpitStyleScoped; | ||
// Rewrite keyframes name in animation decls | ||
const processor = (0, _postcss.default)([scopeKeyframesPostCSSPlugin(key, keyframeSet)]); | ||
@@ -101,7 +91,7 @@ current.meta.marpitStyleScoped.styles = styles.map(style => { | ||
} | ||
}); // Assign scoped styles | ||
}); | ||
// Assign scoped styles | ||
marpit.lastStyles.push(...current.meta.marpitStyleScoped.styles); | ||
} | ||
current = undefined; | ||
@@ -111,8 +101,8 @@ } else if (token.type === 'marpit_style') { | ||
content | ||
} = token; // Scoped style | ||
} = token; | ||
// Scoped style | ||
const { | ||
marpitStyleScoped | ||
} = token.meta || {}; | ||
if (current && marpitStyleScoped) { | ||
@@ -124,3 +114,2 @@ current.meta = current.meta || {}; | ||
} = current.meta.marpitStyleScoped; | ||
if (!key) { | ||
@@ -131,10 +120,9 @@ key = generateUniqKey(); | ||
} | ||
current.meta.marpitStyleScoped.styles = current.meta.marpitStyleScoped.styles || []; | ||
current.meta.marpitStyleScoped.keyframeSet = current.meta.marpitStyleScoped.keyframeSet || new Set(); | ||
const processor = (0, _postcss.default)([injectScopePostCSSplugin(key, current.meta.marpitStyleScoped.keyframeSet)]); | ||
try { | ||
current.meta.marpitStyleScoped.styles.push(processor.process(content).css); | ||
} catch (e) {// No ops | ||
} catch (e) { | ||
// No ops | ||
} | ||
@@ -149,5 +137,5 @@ } else if (content) { | ||
} | ||
var _default = (0, _plugin.default)(assign); | ||
const assign = (0, _plugin.default)(_assign); | ||
exports.assign = assign; | ||
var _default = assign; | ||
exports.default = _default; |
@@ -6,9 +6,7 @@ "use strict"; | ||
}); | ||
exports.default = void 0; | ||
exports.parse = exports.default = void 0; | ||
var _plugin = _interopRequireDefault(require("../../plugin")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/** @module */ | ||
/** @module */ | ||
const styleMatcher = /<style([\s\S]*?)>([\s\S]*?)<\/style>/i; | ||
@@ -18,2 +16,3 @@ const styleMatcherOpening = /^<style(?=(\s|>|$))/i; | ||
const styleMatcherScoped = /\bscoped\b/i; | ||
/** | ||
@@ -28,7 +27,6 @@ * Marpit style parse plugin. | ||
* | ||
* @alias module:markdown/style/parse | ||
* @function parse | ||
* @param {MarkdownIt} md markdown-it instance. | ||
*/ | ||
function parse(md) { | ||
function _parse(md) { | ||
/** | ||
@@ -43,9 +41,10 @@ * Based on markdown-it html_block rule | ||
let max = state.eMarks[startLine]; | ||
let line = state.src.slice(pos, max); // Match to opening element | ||
let line = state.src.slice(pos, max); | ||
// Match to opening element | ||
if (!styleMatcherOpening.test(line)) return false; | ||
if (silent) return true; // Parse ending element | ||
if (silent) return true; | ||
// Parse ending element | ||
let nextLine = startLine + 1; | ||
if (!styleMatcherClosing.test(line)) { | ||
@@ -61,5 +60,5 @@ while (nextLine < endLine) { | ||
} | ||
state.line = nextLine; | ||
state.line = nextLine; // Create token | ||
// Create token | ||
const token = state.push('marpit_style', '', 0); | ||
@@ -71,3 +70,2 @@ token.map = [startLine, nextLine]; | ||
const matchedContent = styleMatcher.exec(token.markup); | ||
if (matchedContent) { | ||
@@ -78,9 +76,8 @@ const [, attrStr, contentStr] = matchedContent; | ||
} | ||
return true; | ||
}); | ||
} | ||
var _default = (0, _plugin.default)(parse); | ||
const parse = (0, _plugin.default)(_parse); | ||
exports.parse = parse; | ||
var _default = parse; | ||
exports.default = _default; |
@@ -6,8 +6,5 @@ "use strict"; | ||
}); | ||
exports.default = void 0; | ||
exports.sweep = exports.default = void 0; | ||
var _plugin = _interopRequireDefault(require("../plugin")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/** @module */ | ||
@@ -25,9 +22,8 @@ | ||
* | ||
* @alias module:markdown/sweep | ||
* @function sweep | ||
* @param {MarkdownIt} md markdown-it instance. | ||
*/ | ||
function sweep(md) { | ||
function _sweep(md) { | ||
md.core.ruler.after('inline', 'marpit_sweep', state => { | ||
if (state.inlineMode) return; | ||
for (const token of state.tokens) { | ||
@@ -43,3 +39,2 @@ if (token.type === 'html_block' && token.content.match(/^\s*$/) || token.type === 'inline' && token.children.filter(t => !(t.hidden || t.type === 'softbreak')).every(t => t.type === 'text' && t.content.match(/^\s*$/))) token.hidden = true; | ||
}; | ||
for (const token of state.tokens) { | ||
@@ -55,3 +50,2 @@ if (token.type === 'inline' && token.hidden) { | ||
const openToken = current.open.pop(); | ||
if (current.tokens[openToken].every(t => t.hidden)) { | ||
@@ -68,5 +62,5 @@ openToken.hidden = true; | ||
} | ||
var _default = (0, _plugin.default)(sweep); | ||
const sweep = (0, _plugin.default)(_sweep); | ||
exports.sweep = sweep; | ||
var _default = sweep; | ||
exports.default = _default; |
@@ -7,63 +7,32 @@ "use strict"; | ||
exports.default = void 0; | ||
var _markdownIt = _interopRequireDefault(require("markdown-it")); | ||
var _element = require("./element"); | ||
var _wrap_array = _interopRequireDefault(require("./helpers/wrap_array")); | ||
var _wrap_array = require("./helpers/wrap_array"); | ||
var _background_image = _interopRequireDefault(require("./markdown/background_image")); | ||
var _collect = _interopRequireDefault(require("./markdown/collect")); | ||
var _comment = _interopRequireDefault(require("./markdown/comment")); | ||
var _container = _interopRequireDefault(require("./markdown/container")); | ||
var _apply = _interopRequireDefault(require("./markdown/directives/apply")); | ||
var _parse = _interopRequireDefault(require("./markdown/directives/parse")); | ||
var _fragment = _interopRequireDefault(require("./markdown/fragment")); | ||
var _header_and_footer = _interopRequireDefault(require("./markdown/header_and_footer")); | ||
var _heading_divider = _interopRequireDefault(require("./markdown/heading_divider")); | ||
var _image = _interopRequireDefault(require("./markdown/image")); | ||
var _inline_svg = _interopRequireDefault(require("./markdown/inline_svg")); | ||
var _slide = _interopRequireWildcard(require("./markdown/slide")); | ||
var _slide_container = _interopRequireDefault(require("./markdown/slide_container")); | ||
var _assign = _interopRequireDefault(require("./markdown/style/assign")); | ||
var _parse2 = _interopRequireDefault(require("./markdown/style/parse")); | ||
var _sweep = _interopRequireDefault(require("./markdown/sweep")); | ||
var _theme_set = _interopRequireDefault(require("./theme_set")); | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); } | ||
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } } | ||
function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; } | ||
function _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError("attempted to set read only private field"); } descriptor.value = value; } } | ||
function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); } | ||
function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); } | ||
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; } | ||
const defaultOptions = { | ||
@@ -83,8 +52,7 @@ anchor: true, | ||
}; | ||
/** | ||
* Parse Marpit Markdown and render to the slide HTML/CSS. | ||
*/ | ||
var _markdown = /*#__PURE__*/new WeakMap(); | ||
class Marpit { | ||
@@ -137,3 +105,2 @@ /** | ||
}); | ||
/** | ||
@@ -151,6 +118,8 @@ * The current options for this instance. | ||
enumerable: true, | ||
value: Object.freeze({ ...defaultOptions, | ||
value: Object.freeze({ | ||
...defaultOptions, | ||
...opts | ||
}) | ||
}); | ||
/** | ||
@@ -168,3 +137,2 @@ * Definitions of the custom directive. | ||
*/ | ||
Object.defineProperty(this, 'customDirectives', { | ||
@@ -176,30 +144,28 @@ value: Object.seal({ | ||
}); | ||
/** | ||
* @type {ThemeSet} | ||
*/ | ||
this.themeSet = new _theme_set.default(); | ||
this.applyMarkdownItPlugins((() => { | ||
// Use CommonMark based instance by default | ||
if (!this.options.markdown) return new _markdownIt.default('commonmark'); // Detect markdown-it features | ||
if (!this.options.markdown) return new _markdownIt.default('commonmark'); | ||
if (typeof this.options.markdown === 'object' && typeof this.options.markdown.parse === 'function' && typeof this.options.markdown.renderer === 'object') return this.options.markdown; // Create instance with passed argument(s) | ||
// Detect markdown-it features | ||
if (typeof this.options.markdown === 'object' && typeof this.options.markdown.parse === 'function' && typeof this.options.markdown.renderer === 'object') return this.options.markdown; | ||
return new _markdownIt.default(...(0, _wrap_array.default)(this.options.markdown)); | ||
// Create instance with passed argument(s) | ||
return new _markdownIt.default(...(0, _wrap_array.wrapArray)(this.options.markdown)); | ||
})()); | ||
} | ||
/** | ||
* @type {MarkdownIt} | ||
*/ | ||
get markdown() { | ||
return _classPrivateFieldGet(this, _markdown); | ||
} | ||
set markdown(md) { | ||
if (_classPrivateFieldGet(this, _markdown) && _classPrivateFieldGet(this, _markdown).marpit) delete _classPrivateFieldGet(this, _markdown).marpit; | ||
_classPrivateFieldSet(this, _markdown, md); | ||
if (md) { | ||
@@ -212,8 +178,6 @@ Object.defineProperty(md, 'marpit', { | ||
} | ||
/** @private */ | ||
applyMarkdownItPlugins(md) { | ||
this.markdown = md; | ||
const slideAnchorCallback = (...args) => { | ||
@@ -227,3 +191,2 @@ const { | ||
}; | ||
md.use(_comment.default).use(_parse2.default).use(_slide.default, { | ||
@@ -233,2 +196,3 @@ anchor: slideAnchorCallback | ||
} | ||
/** | ||
@@ -251,4 +215,2 @@ * @typedef {Object} Marpit~RenderResult | ||
*/ | ||
render(markdown, env = {}) { | ||
@@ -261,2 +223,3 @@ return { | ||
} | ||
/** | ||
@@ -275,13 +238,10 @@ * Render Markdown by using `markdownIt#render`. | ||
*/ | ||
renderMarkdown(markdown, env = {}) { | ||
const tokens = this.markdown.parse(markdown, env); | ||
if (env.htmlAsArray) { | ||
return this.lastSlideTokens.map(slideTokens => this.markdown.renderer.render(slideTokens, this.markdown.options, env)); | ||
} | ||
return this.markdown.renderer.render(tokens, this.markdown.options, env); | ||
} | ||
/** | ||
@@ -296,14 +256,11 @@ * Render style by using `themeSet#pack`. | ||
*/ | ||
renderStyle(theme) { | ||
return this.themeSet.pack(theme, this.themeSetPackOptions()); | ||
} | ||
/** @private */ | ||
themeSetPackOptions() { | ||
return { | ||
after: this.lastStyles ? this.lastStyles.join('\n') : undefined, | ||
containers: [...(0, _wrap_array.default)(this.options.container), ...(0, _wrap_array.default)(this.options.slideContainer)], | ||
containers: [...(0, _wrap_array.wrapArray)(this.options.container), ...(0, _wrap_array.wrapArray)(this.options.slideContainer)], | ||
inlineSVG: this.inlineSVGOptions, | ||
@@ -313,2 +270,3 @@ printable: this.options.printable | ||
} | ||
/** | ||
@@ -318,15 +276,15 @@ * @private | ||
*/ | ||
get inlineSVGOptions() { | ||
if (typeof this.options.inlineSVG === 'object') { | ||
return { ...defaultInlineSVGOptions, | ||
return { | ||
...defaultInlineSVGOptions, | ||
...this.options.inlineSVG | ||
}; | ||
} | ||
return { ...defaultInlineSVGOptions, | ||
return { | ||
...defaultInlineSVGOptions, | ||
enabled: !!this.options.inlineSVG | ||
}; | ||
} | ||
/** | ||
@@ -339,4 +297,2 @@ * Load the specified markdown-it plugin with given parameters. | ||
*/ | ||
use(plugin, ...params) { | ||
@@ -346,6 +302,4 @@ plugin.call(this.markdown, this.markdown, ...params); | ||
} | ||
} | ||
var _default = Marpit; | ||
exports.default = _default; |
@@ -11,3 +11,20 @@ "use strict"; | ||
* | ||
* @alias module:plugin | ||
* @example | ||
* import { marpitPlugin } from '@marp-team/marpit/plugin' | ||
* | ||
* export default marpitPlugin((md) => { | ||
* // Compatible with markdown-it plugin | ||
* md.renderer.rules.your_rule = (tokens, idx, options, env, self) => { | ||
* // ... | ||
* } | ||
* | ||
* // And accessible to Marpit instance as `md.marpit` | ||
* const { marpit } = md | ||
* | ||
* marpit.customDirectives.local.yourDirective = (value) => { | ||
* return { yourDirective: value } | ||
* } | ||
* }) | ||
* | ||
* @function marpitPlugin | ||
* @param {Function} plugin Base plugin for markdown-it. | ||
@@ -23,3 +40,2 @@ * @returns {Function} Generated Marpit plugin. | ||
} | ||
Object.defineProperty(marpitPlugin, '__esModule', { | ||
@@ -26,0 +42,0 @@ value: true |
@@ -6,8 +6,5 @@ "use strict"; | ||
}); | ||
exports.default = void 0; | ||
exports.default = exports.advancedBackground = void 0; | ||
var _postcss_plugin = _interopRequireDefault(require("../helpers/postcss_plugin")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/** @module */ | ||
@@ -20,5 +17,5 @@ | ||
* | ||
* @alias module:postcss/advanced_background | ||
* @function advancedBackground | ||
*/ | ||
const plugin = (0, _postcss_plugin.default)('marpit-postcss-advanced-background', () => css => { | ||
const advancedBackground = (0, _postcss_plugin.default)('marpit-postcss-advanced-background', () => css => { | ||
css.last.after(` | ||
@@ -84,3 +81,4 @@ section[data-marpit-advanced-background="background"] { | ||
}); | ||
var _default = plugin; | ||
exports.advancedBackground = advancedBackground; | ||
var _default = advancedBackground; | ||
exports.default = _default; |
@@ -6,10 +6,6 @@ "use strict"; | ||
}); | ||
exports.default = void 0; | ||
exports.importParse = exports.default = void 0; | ||
var _postcss_plugin = _interopRequireDefault(require("../../helpers/postcss_plugin")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/* eslint consistent-return: 0 */ | ||
/** @module */ | ||
@@ -39,5 +35,5 @@ | ||
* | ||
* @alias module:postcss/import/parse | ||
* @function importParse | ||
*/ | ||
const plugin = (0, _postcss_plugin.default)('marpit-postcss-import-parse', () => (css, { | ||
const importParse = (0, _postcss_plugin.default)('marpit-postcss-import-parse', () => (css, { | ||
result | ||
@@ -62,3 +58,2 @@ }) => { | ||
} | ||
value = `${value}${v}`; | ||
@@ -73,3 +68,2 @@ return false; | ||
}; | ||
if (allowImport) { | ||
@@ -82,3 +76,2 @@ if (node.name === 'import') { | ||
} | ||
if (node.name === 'import-theme' && node.parent.type === 'root') { | ||
@@ -93,3 +86,4 @@ push(imports.importTheme); | ||
}); | ||
var _default = plugin; | ||
exports.importParse = importParse; | ||
var _default = importParse; | ||
exports.default = _default; |
@@ -6,10 +6,6 @@ "use strict"; | ||
}); | ||
exports.default = void 0; | ||
exports.importReplace = exports.default = void 0; | ||
var _postcss_plugin = _interopRequireDefault(require("../../helpers/postcss_plugin")); | ||
var _parse = _interopRequireDefault(require("./parse")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/** @module */ | ||
@@ -25,6 +21,6 @@ | ||
* | ||
* @alias module:postcss/import/replace | ||
* @function importReplace | ||
* @param {ThemeSet} themeSet ThemeSet instance. | ||
*/ | ||
const plugin = (themeSet, importedThemes = []) => (0, _postcss_plugin.default)('marpit-postcss-import-replace', () => ({ | ||
const importReplace = (themeSet, importedThemes = []) => (0, _postcss_plugin.default)('marpit-postcss-import-replace', () => ({ | ||
plugins: [(0, _parse.default)(), (0, _postcss_plugin.default)('marpit-postcss-import-replace-processor', () => (css, { | ||
@@ -36,10 +32,7 @@ postcss | ||
const name = node.marpitImportParse; | ||
if (name) { | ||
const theme = themeSet.get(name); | ||
if (theme) { | ||
if (importedThemes.includes(name)) throw new Error(`Circular "${name}" theme import is detected.`); | ||
const processed = postcss([plugin(themeSet, [...importedThemes, name])]).process(theme.css); | ||
const processed = postcss([importReplace(themeSet, [...importedThemes, name])]).process(theme.css); | ||
if (node.name === 'import') { | ||
@@ -54,8 +47,7 @@ node.replaceWith(processed.root); | ||
}); | ||
for (const root of prepends) css.first.before(root); | ||
})()] | ||
})); | ||
var _default = plugin; | ||
exports.importReplace = importReplace; | ||
var _default = importReplace; | ||
exports.default = _default; |
@@ -6,10 +6,6 @@ "use strict"; | ||
}); | ||
exports.default = void 0; | ||
exports.importSuppress = exports.default = void 0; | ||
var _postcss_plugin = _interopRequireDefault(require("../../helpers/postcss_plugin")); | ||
var _parse = _interopRequireDefault(require("./parse")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/** @module */ | ||
@@ -25,6 +21,6 @@ | ||
* | ||
* @alias module:postcss/import/suppress | ||
* @function importSuppress | ||
* @param {ThemeSet} themeSet ThemeSet instance. | ||
*/ | ||
const plugin = (0, _postcss_plugin.default)('marpit-postcss-import-suppress', themeSet => ({ | ||
const importSuppress = (0, _postcss_plugin.default)('marpit-postcss-import-suppress', themeSet => ({ | ||
plugins: [(0, _parse.default)(), (0, _postcss_plugin.default)('marpit-postcss-import-suppress', () => css => { | ||
@@ -36,3 +32,4 @@ css.walk(node => { | ||
})); | ||
var _default = plugin; | ||
exports.importSuppress = importSuppress; | ||
var _default = importSuppress; | ||
exports.default = _default; |
@@ -6,8 +6,5 @@ "use strict"; | ||
}); | ||
exports.default = void 0; | ||
exports.meta = exports.default = void 0; | ||
var _postcss_plugin = _interopRequireDefault(require("../helpers/postcss_plugin")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/** @module */ | ||
@@ -20,7 +17,7 @@ | ||
* | ||
* @function meta | ||
* @param {Object} [opts] | ||
* @param {Object} [opts.metaType] An object for defined types for metadata. | ||
* @alias module:postcss/meta | ||
*/ | ||
const plugin = (0, _postcss_plugin.default)('marpit-postcss-meta', (opts = {}) => (css, { | ||
const meta = (0, _postcss_plugin.default)('marpit-postcss-meta', (opts = {}) => (css, { | ||
result | ||
@@ -42,3 +39,4 @@ }) => { | ||
}); | ||
var _default = plugin; | ||
exports.meta = meta; | ||
var _default = meta; | ||
exports.default = _default; |
@@ -6,8 +6,5 @@ "use strict"; | ||
}); | ||
exports.default = void 0; | ||
exports.pagination = exports.default = void 0; | ||
var _postcss_plugin = _interopRequireDefault(require("../helpers/postcss_plugin")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/** @module */ | ||
@@ -25,5 +22,5 @@ | ||
* | ||
* @alias module:postcss/pagination | ||
* @function pagination | ||
*/ | ||
const plugin = (0, _postcss_plugin.default)('marpit-postcss-pagination', () => css => { | ||
const pagination = (0, _postcss_plugin.default)('marpit-postcss-pagination', () => css => { | ||
css.walkRules(rule => { | ||
@@ -35,3 +32,4 @@ if (rule.selectors.some(selector => /^section(?![\w-])[^\s>+~]*::?after$/.test(selector.replace(/\[.*?\]/g, '')))) rule.walkDecls('content', decl => { | ||
}); | ||
var _default = plugin; | ||
exports.pagination = pagination; | ||
var _default = pagination; | ||
exports.default = _default; |
@@ -6,9 +6,7 @@ "use strict"; | ||
}); | ||
exports.postprocess = exports.default = void 0; | ||
exports.printable = exports.postprocess = exports.default = void 0; | ||
var _postcss_plugin = _interopRequireDefault(require("../helpers/postcss_plugin")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/** @module */ | ||
/** @module */ | ||
const marpitPrintContainerStyle = ` | ||
@@ -22,2 +20,3 @@ html, body { | ||
`.trim(); | ||
/** | ||
@@ -31,6 +30,5 @@ * Marpit PostCSS printable plugin. | ||
* @param {string} opts.height | ||
* @alias module:postcss/printable | ||
* @function printable | ||
*/ | ||
const plugin = (0, _postcss_plugin.default)('marpit-postcss-printable', opts => css => { | ||
const printable = (0, _postcss_plugin.default)('marpit-postcss-printable', opts => css => { | ||
css.walkAtRules('media', rule => { | ||
@@ -67,8 +65,9 @@ if (rule.params === 'marpit-print') rule.remove(); | ||
}); | ||
/** | ||
* The post-process PostCSS plugin of Marpit printable plugin. | ||
* | ||
* @alias module:postcss/printable.postprocess | ||
* @function postprocess | ||
*/ | ||
exports.printable = printable; | ||
const postprocess = (0, _postcss_plugin.default)('marpit-postcss-printable-postprocess', () => css => css.walkAtRules('media', rule => { | ||
@@ -80,3 +79,3 @@ if (rule.params !== 'marpit-print') return; | ||
exports.postprocess = postprocess; | ||
var _default = plugin; | ||
var _default = printable; | ||
exports.default = _default; |
@@ -6,8 +6,5 @@ "use strict"; | ||
}); | ||
exports.default = void 0; | ||
exports.pseudoSelectorPrepend = exports.default = void 0; | ||
var _postcss_plugin = _interopRequireDefault(require("../../helpers/postcss_plugin")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/** @module */ | ||
@@ -21,5 +18,5 @@ | ||
* | ||
* @alias module:postcss/pseudo_selector/prepend | ||
* @function pseudoSelectorPrepend | ||
*/ | ||
const plugin = (0, _postcss_plugin.default)('marpit-postcss-pseudo-selector-prepend', () => css => css.walkRules(rule => { | ||
const pseudoSelectorPrepend = (0, _postcss_plugin.default)('marpit-postcss-pseudo-selector-prepend', () => css => css.walkRules(rule => { | ||
const { | ||
@@ -36,3 +33,4 @@ type, | ||
})); | ||
var _default = plugin; | ||
exports.pseudoSelectorPrepend = pseudoSelectorPrepend; | ||
var _default = pseudoSelectorPrepend; | ||
exports.default = _default; |
@@ -6,13 +6,9 @@ "use strict"; | ||
}); | ||
exports.default = void 0; | ||
exports.pseudoSelectorReplace = exports.default = void 0; | ||
var _cssesc = _interopRequireDefault(require("cssesc")); | ||
var _postcss_plugin = _interopRequireDefault(require("../../helpers/postcss_plugin")); | ||
var _wrap_array = _interopRequireDefault(require("../../helpers/wrap_array")); | ||
var _wrap_array = require("../../helpers/wrap_array"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/** @module */ | ||
/** @module */ | ||
const buildSelector = elms => elms.map(e => { | ||
@@ -28,2 +24,3 @@ const classes = new Set((e.class || '').split(/\s+/).filter(c => c)); | ||
}).join(' > '); | ||
/** | ||
@@ -35,13 +32,11 @@ * Marpit PostCSS pseudo selector replace plugin. | ||
* | ||
* @alias module:postcss/pseudo_selector/replace | ||
* @function pseudoSelectorReplace | ||
* @param {Element|Element[]} [elements] Container elements | ||
* @param {Element|Element[]} [slideElements={ tag: 'section' }] Slide elements | ||
*/ | ||
const plugin = (0, _postcss_plugin.default)('marpit-postcss-pseudo-selector-replace', (elements, slideElements = { | ||
const pseudoSelectorReplace = (0, _postcss_plugin.default)('marpit-postcss-pseudo-selector-replace', (elements, slideElements = { | ||
tag: 'section' | ||
}) => { | ||
const container = buildSelector([...(0, _wrap_array.default)(elements)]); | ||
const section = buildSelector([...(0, _wrap_array.default)(slideElements)]); | ||
const container = buildSelector([...(0, _wrap_array.wrapArray)(elements)]); | ||
const section = buildSelector([...(0, _wrap_array.wrapArray)(slideElements)]); | ||
return css => css.walkRules(rule => { | ||
@@ -51,3 +46,4 @@ rule.selectors = rule.selectors.map(selector => selector.replace(/:marpit-container(?![\w-])/g, container).replace(/:marpit-slide(?![\w-])/g, section).replace(/^\s*>\s*/, '')); | ||
}); | ||
var _default = plugin; | ||
exports.pseudoSelectorReplace = pseudoSelectorReplace; | ||
var _default = pseudoSelectorReplace; | ||
exports.default = _default; |
@@ -6,10 +6,9 @@ "use strict"; | ||
}); | ||
exports.rootFontSizeCustomProp = exports.default = void 0; | ||
exports.rootFontSizeCustomProp = exports.rootFontSize = exports.default = void 0; | ||
var _postcss_plugin = _interopRequireDefault(require("../../helpers/postcss_plugin")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/** @module */ | ||
/** @module */ | ||
const rootFontSizeCustomProp = '--marpit-root-font-size'; | ||
/** | ||
@@ -21,9 +20,7 @@ * Marpit PostCSS root font size plugin. | ||
* | ||
* @alias module:postcss/root/font_size | ||
* @function rootFontSize | ||
*/ | ||
exports.rootFontSizeCustomProp = rootFontSizeCustomProp; | ||
const plugin = (0, _postcss_plugin.default)('marpit-postcss-root-font-size', () => (css, postcss) => css.walkRules(rule => { | ||
const rootFontSize = (0, _postcss_plugin.default)('marpit-postcss-root-font-size', () => (css, postcss) => css.walkRules(rule => { | ||
const injectSelector = new Set(); | ||
for (const selector of rule.selectors) { | ||
@@ -35,12 +32,12 @@ // Detect whether the selector is targeted to section | ||
const target = delimiterMatched ? targetSelector.slice(0, delimiterMatched.index) : targetSelector; | ||
if (target === 'section' || target.endsWith('*') || target === '') { | ||
// Generate selector for injection | ||
injectSelector.add([...parentSelectors, target === 'section' ? 'section' : ':marpit-container > :marpit-slide section', // Universal selector is targeted to the children `section` of root `section` | ||
injectSelector.add([...parentSelectors, target === 'section' ? 'section' : ':marpit-container > :marpit-slide section', | ||
// Universal selector is targeted to the children `section` of root `section` | ||
delimiterMatched ? targetSelector.slice(delimiterMatched.index) : ''].join('')); | ||
} | ||
} | ||
if (injectSelector.size === 0) return; | ||
if (injectSelector.size === 0) return; // Inject CSS variable | ||
// Inject CSS variable | ||
const injectRule = postcss.rule({ | ||
@@ -56,3 +53,4 @@ selectors: [...injectSelector.values()] | ||
})); | ||
var _default = plugin; | ||
exports.rootFontSize = rootFontSize; | ||
var _default = rootFontSize; | ||
exports.default = _default; |
@@ -6,12 +6,11 @@ "use strict"; | ||
}); | ||
exports.pseudoClass = exports.default = void 0; | ||
exports.rootIncreasingSpecificity = exports.pseudoClass = exports.default = void 0; | ||
var _postcss_plugin = _interopRequireDefault(require("../../helpers/postcss_plugin")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/** @module */ | ||
/** @module */ | ||
const pseudoClass = ':marpit-root'; | ||
exports.pseudoClass = pseudoClass; | ||
const matcher = new RegExp(`\\b(?:section)?${pseudoClass}\\b`, 'g'); | ||
/** | ||
@@ -25,9 +24,9 @@ * Marpit PostCSS root increasing specificity plugin. | ||
* | ||
* @alias module:postcss/root/increasing_specificity | ||
* @function rootIncreasingSpecificity | ||
*/ | ||
const plugin = (0, _postcss_plugin.default)('marpit-postcss-root-increasing-specificity', () => css => css.walkRules(rule => { | ||
const rootIncreasingSpecificity = (0, _postcss_plugin.default)('marpit-postcss-root-increasing-specificity', () => css => css.walkRules(rule => { | ||
rule.selectors = rule.selectors.map(selector => selector.replace(matcher, ':where(section):not([\\20 root])')); | ||
})); | ||
var _default = plugin; | ||
exports.rootIncreasingSpecificity = rootIncreasingSpecificity; | ||
var _default = rootIncreasingSpecificity; | ||
exports.default = _default; |
@@ -6,12 +6,10 @@ "use strict"; | ||
}); | ||
exports.default = void 0; | ||
exports.rem = exports.default = void 0; | ||
var _postcss_plugin = _interopRequireDefault(require("../../helpers/postcss_plugin")); | ||
var _font_size = require("./font_size"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/** @module */ | ||
/** @module */ | ||
const skipParsingMatcher = /("[^"]*"|'[^']*'|(?:attr|url|var)\([^)]*\))/g; | ||
/** | ||
@@ -22,6 +20,5 @@ * Marpit PostCSS rem plugin. | ||
* | ||
* @alias module:postcss/root/rem | ||
* @function rem | ||
*/ | ||
const plugin = (0, _postcss_plugin.default)('marpit-postcss-rem', () => css => css.walkDecls(decl => { | ||
const rem = (0, _postcss_plugin.default)('marpit-postcss-rem', () => css => css.walkDecls(decl => { | ||
decl.value = decl.value.split(skipParsingMatcher).map((v, i) => { | ||
@@ -32,3 +29,4 @@ if (i % 2) return v; | ||
})); | ||
var _default = plugin; | ||
exports.rem = rem; | ||
var _default = rem; | ||
exports.default = _default; |
@@ -6,8 +6,5 @@ "use strict"; | ||
}); | ||
exports.default = void 0; | ||
exports.rootReplace = exports.default = void 0; | ||
var _postcss_plugin = _interopRequireDefault(require("../../helpers/postcss_plugin")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/** @module */ | ||
@@ -22,5 +19,5 @@ | ||
* | ||
* @alias module:postcss/root/replace | ||
* @function rootReplace | ||
*/ | ||
const plugin = (0, _postcss_plugin.default)('marpit-postcss-root-replace', ({ | ||
const rootReplace = (0, _postcss_plugin.default)('marpit-postcss-root-replace', ({ | ||
pseudoClass | ||
@@ -31,3 +28,4 @@ } = {}) => css => css.walkRules(rule => { | ||
})); | ||
var _default = plugin; | ||
exports.rootReplace = rootReplace; | ||
var _default = rootReplace; | ||
exports.default = _default; |
@@ -6,8 +6,5 @@ "use strict"; | ||
}); | ||
exports.default = void 0; | ||
exports.sectionSize = exports.default = void 0; | ||
var _postcss_plugin = _interopRequireDefault(require("../helpers/postcss_plugin")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/** @module */ | ||
@@ -20,5 +17,5 @@ | ||
* | ||
* @alias module:postcss/section_size | ||
* @function sectionSize | ||
*/ | ||
const plugin = (0, _postcss_plugin.default)('marpit-postcss-section-size', ({ | ||
const sectionSize = (0, _postcss_plugin.default)('marpit-postcss-section-size', ({ | ||
preferedPseudoClass | ||
@@ -44,3 +41,2 @@ } = {}) => { | ||
const value = decl.value.trim(); | ||
if (matched[1]) { | ||
@@ -56,3 +52,4 @@ preferedSize[prop] = value; | ||
const height = preferedSize.height || detectedSize.height || originalSize.height; | ||
result.marpitSectionSize = { ...originalSize | ||
result.marpitSectionSize = { | ||
...originalSize | ||
}; | ||
@@ -63,3 +60,4 @@ if (width) result.marpitSectionSize.width = width; | ||
}); | ||
var _default = plugin; | ||
exports.sectionSize = sectionSize; | ||
var _default = sectionSize; | ||
exports.default = _default; |
@@ -6,10 +6,9 @@ "use strict"; | ||
}); | ||
exports.default = void 0; | ||
exports.svgBackdrop = exports.default = void 0; | ||
var _postcss_plugin = _interopRequireDefault(require("../helpers/postcss_plugin")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/** @module */ | ||
/** @module */ | ||
const backdropMatcher = /(?:\b|^)::backdrop$/; | ||
/** | ||
@@ -47,17 +46,14 @@ * Marpit PostCSS SVG backdrop plugin. | ||
* @see https://developer.mozilla.org/docs/Web/CSS/::backdrop | ||
* @alias module:postcss/svg_backdrop | ||
* @function svgBackdrop | ||
*/ | ||
const plugin = (0, _postcss_plugin.default)('marpit-postcss-svg-backdrop', () => (css, postcss) => { | ||
const svgBackdrop = (0, _postcss_plugin.default)('marpit-postcss-svg-backdrop', () => (css, postcss) => { | ||
css.walkRules(rule => { | ||
const injectSelectors = new Set(); | ||
for (const selector of rule.selectors) { | ||
// Detect pseudo-element (must appear after the simple selectors) | ||
if (!selector.match(backdropMatcher)) continue; // Detect whether the selector is targeted to section | ||
if (!selector.match(backdropMatcher)) continue; | ||
// Detect whether the selector is targeted to section | ||
const delimiterMatched = selector.match(/[.:#[]/); // must match | ||
const target = selector.slice(0, delimiterMatched.index); | ||
if (target === 'section' || target === '') { | ||
@@ -68,3 +64,2 @@ const delimiter = selector.slice(delimiterMatched.index, -10); | ||
} | ||
if (injectSelectors.size > 0 && rule.nodes.length > 0) { | ||
@@ -82,3 +77,4 @@ rule.parent.insertAfter(rule, postcss.atRule({ | ||
}); | ||
var _default = plugin; | ||
exports.svgBackdrop = svgBackdrop; | ||
var _default = svgBackdrop; | ||
exports.default = _default; |
@@ -7,43 +7,22 @@ "use strict"; | ||
exports.default = void 0; | ||
var _postcss = _interopRequireDefault(require("postcss")); | ||
var _postcss_plugin = _interopRequireDefault(require("./helpers/postcss_plugin")); | ||
var _advanced_background = _interopRequireDefault(require("./postcss/advanced_background")); | ||
var _hoisting = _interopRequireDefault(require("./postcss/import/hoisting")); | ||
var _replace = _interopRequireDefault(require("./postcss/import/replace")); | ||
var _rollup = _interopRequireDefault(require("./postcss/import/rollup")); | ||
var _suppress = _interopRequireDefault(require("./postcss/import/suppress")); | ||
var _pagination = _interopRequireDefault(require("./postcss/pagination")); | ||
var _printable = _interopRequireWildcard(require("./postcss/printable")); | ||
var _prepend = _interopRequireDefault(require("./postcss/pseudo_selector/prepend")); | ||
var _replace2 = _interopRequireDefault(require("./postcss/pseudo_selector/replace")); | ||
var _font_size = _interopRequireDefault(require("./postcss/root/font_size")); | ||
var _increasing_specificity = _interopRequireWildcard(require("./postcss/root/increasing_specificity")); | ||
var _rem = _interopRequireDefault(require("./postcss/root/rem")); | ||
var _replace3 = _interopRequireDefault(require("./postcss/root/replace")); | ||
var _svg_backdrop = _interopRequireDefault(require("./postcss/svg_backdrop")); | ||
var _theme = _interopRequireDefault(require("./theme")); | ||
var _scaffold = _interopRequireDefault(require("./theme/scaffold")); | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/** | ||
@@ -69,2 +48,3 @@ * Marpit theme set class. | ||
this.default = undefined; | ||
/** | ||
@@ -108,3 +88,2 @@ * The default type settings for theme metadata added by | ||
*/ | ||
this.metaType = {}; | ||
@@ -115,2 +94,3 @@ Object.defineProperty(this, 'themeMap', { | ||
} | ||
/** | ||
@@ -122,7 +102,6 @@ * Return the number of themes. | ||
*/ | ||
get size() { | ||
return this.themeMap.size; | ||
} | ||
/** | ||
@@ -136,4 +115,2 @@ * Add theme CSS from string. | ||
*/ | ||
add(css) { | ||
@@ -143,6 +120,6 @@ const theme = _theme.default.fromCSS(css, { | ||
}); | ||
this.addTheme(theme); | ||
return theme; | ||
} | ||
/** | ||
@@ -154,4 +131,2 @@ * Add theme instance. | ||
*/ | ||
addTheme(theme) { | ||
@@ -162,10 +137,10 @@ if (!(theme instanceof _theme.default)) throw new Error('ThemeSet can add only an instance of Theme.'); | ||
} | ||
/** | ||
* Removes all themes from a {@link themeSet} object. | ||
*/ | ||
clear() { | ||
return this.themeMap.clear(); | ||
} | ||
/** | ||
@@ -178,7 +153,6 @@ * Remove a specific named theme from a {@link themeSet} object. | ||
*/ | ||
delete(name) { | ||
return this.themeMap.delete(name); | ||
} | ||
/** | ||
@@ -194,4 +168,2 @@ * Returns a specific named theme. | ||
*/ | ||
get(name, fallback = false) { | ||
@@ -201,2 +173,3 @@ const theme = this.themeMap.get(name); | ||
} | ||
/** | ||
@@ -214,18 +187,15 @@ * Returns value(s) of specified metadata from a theme. It considers `@import` | ||
*/ | ||
getThemeMeta(theme, meta) { | ||
const themeInstance = theme instanceof _theme.default ? theme : this.get(theme); | ||
const metas = themeInstance ? this.resolveImport(themeInstance).map(t => t.meta[meta]).filter(m => m) : []; // Flatten in order of definitions when the all of valid values are array | ||
const metas = themeInstance ? this.resolveImport(themeInstance).map(t => t.meta[meta]).filter(m => m) : []; | ||
// Flatten in order of definitions when the all of valid values are array | ||
if (metas.length > 0 && metas.every(m => Array.isArray(m))) { | ||
const mergedArray = []; | ||
for (const m of metas) mergedArray.unshift(...m); | ||
return mergedArray; | ||
} | ||
return metas[0]; | ||
} | ||
/** | ||
@@ -242,4 +212,2 @@ * Returns the value of specified property name from a theme. It considers | ||
*/ | ||
getThemeProp(theme, prop) { | ||
@@ -250,2 +218,3 @@ const themeInstance = theme instanceof _theme.default ? theme : this.get(theme); | ||
} | ||
/** | ||
@@ -258,7 +227,6 @@ * Returns a boolean indicating whether a specific named theme exists or not. | ||
*/ | ||
has(name) { | ||
return this.themeMap.has(name); | ||
} | ||
/** | ||
@@ -268,4 +236,4 @@ * Convert registered theme CSS into usable in the rendered markdown by | ||
* | ||
* You should use {@link Marpit#render} unless there is some particular | ||
* reason. | ||
* **This method is designed for internal use by {@link Marpit} class.** Use | ||
* {@link Marpit#render} instead unless there is some particular reason. | ||
* | ||
@@ -284,4 +252,2 @@ * @param {string} name The theme name. It will use the instance's default | ||
*/ | ||
pack(name, opts = {}) { | ||
@@ -293,3 +259,2 @@ const slideElements = [{ | ||
const inlineSVGOpts = opts.inlineSVG || {}; | ||
if (inlineSVGOpts.enabled) { | ||
@@ -302,6 +267,4 @@ slideElements.unshift({ | ||
} | ||
const additionalCSS = css => { | ||
if (!css) return undefined; | ||
try { | ||
@@ -313,3 +276,2 @@ return (0, _postcss.default)([(0, _suppress.default)(this)]).process(css).css; | ||
}; | ||
const after = additionalCSS(opts.after); | ||
@@ -319,3 +281,3 @@ const before = additionalCSS(opts.before); | ||
css.last.after(after); | ||
}), _rollup.default, (0, _replace.default)(this), opts.printable && (0, _printable.default)({ | ||
}), _hoisting.default, (0, _replace.default)(this), opts.printable && (0, _printable.default)({ | ||
width: this.getThemeProp(theme, 'width'), | ||
@@ -325,5 +287,6 @@ height: this.getThemeProp(theme, 'height') | ||
pseudoClass: _increasing_specificity.pseudoClass | ||
}), _font_size.default, _prepend.default, (0, _replace2.default)(opts.containers, slideElements), _increasing_specificity.default, opts.printable && _printable.postprocess, _rem.default, _rollup.default].filter(p => p)); | ||
}), _font_size.default, _prepend.default, (0, _replace2.default)(opts.containers, slideElements), _increasing_specificity.default, opts.printable && _printable.postprocess, _rem.default, _hoisting.default].filter(p => p)); | ||
return packer.process(theme.css).css; | ||
} | ||
/** | ||
@@ -335,7 +298,6 @@ * Returns a `Iterator` object that contains registered themes to current | ||
*/ | ||
themes() { | ||
return this.themeMap.values(); | ||
} | ||
/** | ||
@@ -349,4 +311,2 @@ * Resolves `@import` and `@import-theme` and returns an array of using theme | ||
*/ | ||
resolveImport(theme, importedThemes = []) { | ||
@@ -364,6 +324,4 @@ const { | ||
} | ||
} | ||
var _default = ThemeSet; | ||
exports.default = _default; |
@@ -7,19 +7,10 @@ "use strict"; | ||
exports.default = void 0; | ||
var _postcss = _interopRequireDefault(require("postcss")); | ||
var _parse = _interopRequireDefault(require("./postcss/import/parse")); | ||
var _meta = _interopRequireDefault(require("./postcss/meta")); | ||
var _increasing_specificity = require("./postcss/root/increasing_specificity"); | ||
var _replace = _interopRequireDefault(require("./postcss/root/replace")); | ||
var _section_size = _interopRequireDefault(require("./postcss/section_size")); | ||
var _symbol = _interopRequireDefault(require("./theme/symbol")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
const absoluteUnits = { | ||
@@ -33,3 +24,2 @@ cm: v => v * 960 / 25.4, | ||
}; | ||
const convertToPixel = value => { | ||
@@ -45,12 +35,10 @@ if (typeof value !== 'string') return undefined; | ||
}; | ||
const memoizeProp = name => `${name}Memoized`; | ||
const reservedMetaType = { | ||
theme: String | ||
}; | ||
/** | ||
* Marpit theme class. | ||
*/ | ||
class Theme { | ||
@@ -73,2 +61,3 @@ /** | ||
this.name = name; | ||
/** | ||
@@ -78,4 +67,4 @@ * The content of theme CSS. | ||
*/ | ||
this.css = css; | ||
this.css = css; | ||
/** | ||
@@ -85,4 +74,4 @@ * Parsed metadata from CSS comments. | ||
*/ | ||
this.meta = Object.freeze({}); | ||
this.meta = Object.freeze({}); | ||
/** | ||
@@ -92,4 +81,4 @@ * Parsed `@import` rules. | ||
*/ | ||
this.importRules = []; | ||
this.importRules = []; | ||
/** | ||
@@ -99,4 +88,4 @@ * Slide width. It requires the absolute unit supported in CSS. | ||
*/ | ||
this.width = undefined; | ||
this.width = undefined; | ||
/** | ||
@@ -106,3 +95,2 @@ * Slide height. It requires the absolute unit supported in CSS. | ||
*/ | ||
this.height = undefined; | ||
@@ -112,2 +100,3 @@ this.memoizeInit('width'); | ||
} | ||
/** | ||
@@ -122,6 +111,5 @@ * Create a Theme instance from Marpit theme CSS. | ||
*/ | ||
static fromCSS(cssString, opts = {}) { | ||
const metaType = { ...(opts.metaType || {}), | ||
const metaType = { | ||
...(opts.metaType || {}), | ||
...reservedMetaType | ||
@@ -142,8 +130,11 @@ }; | ||
theme.importRules = [...result.marpitImport]; | ||
theme.meta = Object.freeze({ ...result.marpitMeta | ||
theme.meta = Object.freeze({ | ||
...result.marpitMeta | ||
}); | ||
Object.assign(theme, { ...result.marpitSectionSize | ||
Object.assign(theme, { | ||
...result.marpitSectionSize | ||
}); | ||
return Object.freeze(theme); | ||
} | ||
/** | ||
@@ -156,7 +147,6 @@ * The converted width into pixel. | ||
*/ | ||
get widthPixel() { | ||
return this.memoize('width', convertToPixel); | ||
} | ||
/** | ||
@@ -169,10 +159,7 @@ * The converted height into pixel. | ||
*/ | ||
get heightPixel() { | ||
return this.memoize('height', convertToPixel); | ||
} | ||
/** @private */ | ||
memoize(prop, func) { | ||
@@ -184,5 +171,4 @@ if (this[memoizeProp(prop)].has(this[prop])) return this[memoizeProp(prop)].get(this[prop]); | ||
} | ||
/** @private */ | ||
memoizeInit(prop) { | ||
@@ -193,6 +179,4 @@ if (!this[memoizeProp(prop)]) Object.defineProperty(this, memoizeProp(prop), { | ||
} | ||
} | ||
var _default = Theme; | ||
exports.default = _default; |
@@ -6,11 +6,8 @@ "use strict"; | ||
}); | ||
exports.default = void 0; | ||
exports.scaffoldTheme = exports.default = void 0; | ||
var _theme = _interopRequireDefault(require("../theme")); | ||
var _symbol = _interopRequireDefault(require("./symbol")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/** @module */ | ||
/** @module */ | ||
const css = ` | ||
@@ -51,2 +48,3 @@ section { | ||
`.trim(); | ||
/** | ||
@@ -60,11 +58,9 @@ * The scaffold theme. It includes these features: | ||
* | ||
* @alias module:theme/scaffold | ||
* @type {Theme} | ||
*/ | ||
const scaffoldTheme = _theme.default.fromCSS(css, { | ||
[_symbol.default]: true | ||
}); | ||
exports.scaffoldTheme = scaffoldTheme; | ||
var _default = scaffoldTheme; | ||
exports.default = _default; |
@@ -7,6 +7,4 @@ "use strict"; | ||
exports.default = void 0; | ||
// This symbol is for internal to skip name validation when creating theme. | ||
var _default = Symbol('skipThemeValidation'); | ||
exports.default = _default; |
{ | ||
"name": "@marp-team/marpit", | ||
"version": "2.4.1", | ||
"version": "2.4.2", | ||
"description": "The skinny framework for creating slide deck from Markdown", | ||
@@ -62,18 +62,18 @@ "license": "MIT", | ||
"devDependencies": { | ||
"@babel/cli": "^7.18.10", | ||
"@babel/core": "^7.19.0", | ||
"@babel/eslint-parser": "^7.18.9", | ||
"@babel/preset-env": "^7.19.0", | ||
"autoprefixer": "^10.4.8", | ||
"@babel/cli": "^7.19.3", | ||
"@babel/core": "^7.20.2", | ||
"@babel/eslint-parser": "^7.19.1", | ||
"@babel/preset-env": "^7.20.2", | ||
"autoprefixer": "^10.4.13", | ||
"cheerio": "^1.0.0-rc.12", | ||
"chokidar": "^3.5.3", | ||
"cssnano": "^5.1.13", | ||
"cssnano": "^5.1.14", | ||
"dedent": "^0.7.0", | ||
"docsify-themeable": "^0.9.0", | ||
"eslint": "^8.23.0", | ||
"eslint": "^8.27.0", | ||
"eslint-config-prettier": "^8.5.0", | ||
"eslint-plugin-import": "^2.26.0", | ||
"jest": "^29.0.2", | ||
"jest": "^29.3.1", | ||
"jest-junit": "^14.0.1", | ||
"jsdoc": "^3.6.11", | ||
"jsdoc": "^4.0.0", | ||
"minami": "^1.2.3", | ||
@@ -83,8 +83,9 @@ "npm-run-all": "^4.1.5", | ||
"rimraf": "^3.0.2", | ||
"sass": "1.54.9", | ||
"serve-handler": "^6.1.3", | ||
"stylelint": "^14.11.0", | ||
"stylelint-config-prettier": "^9.0.3", | ||
"stylelint-config-standard-scss": "^5.0.0", | ||
"ws": "^8.8.1" | ||
"sass": "1.56.1", | ||
"serve-handler": "^6.1.5", | ||
"stylelint": "^14.15.0", | ||
"stylelint-config-prettier": "^9.0.4", | ||
"stylelint-config-standard-scss": "^6.1.0", | ||
"taffydb": "npm:@jsdoc/salty@^0.2.1", | ||
"ws": "^8.11.0" | ||
}, | ||
@@ -98,3 +99,3 @@ "dependencies": { | ||
"markdown-it-front-matter": "^0.2.3", | ||
"postcss": "^8.4.16" | ||
"postcss": "^8.4.19" | ||
}, | ||
@@ -101,0 +102,0 @@ "publishConfig": { |
<p align="center"> | ||
<a href="https://marpit.marp.app"><img src="https://github.com/marp-team/marpit/blob/main/docs/marpit.png?raw=true" alt="Marpit" width="500" /></a> | ||
<img src="docs/marpit.png#gh-light-mode-only" alt="Marpit" width="500" /> | ||
<img src="docs/marpit-dark.png#gh-dark-mode-only" alt="Marpit" width="500" /> | ||
</p> | ||
@@ -14,2 +15,8 @@ <p align="center"> | ||
<div align="center"> | ||
### [🗒 Documentation](https://marpit.marp.app/) | [⚙ API](https://marpit-api.marp.app/) | ||
</div> | ||
--- | ||
@@ -49,7 +56,10 @@ | ||
## Development | ||
## Contributing | ||
Are you interested in contributing? See [CONTRIBUTING.md](.github/CONTRIBUTING.md) and [the common contributing guideline for Marp team](https://github.com/marp-team/.github/blob/master/CONTRIBUTING.md). | ||
### Development | ||
```bash | ||
git clone https://github.com/marp-team/marpit | ||
cd marpit | ||
@@ -61,6 +71,2 @@ | ||
## Contributing | ||
Are you interested in contributing? Please see [CONTRIBUTING.md](.github/CONTRIBUTING.md) and [the common contributing guideline for Marp team](https://github.com/marp-team/.github/blob/master/CONTRIBUTING.md). | ||
## Sub-projects | ||
@@ -67,0 +73,0 @@ |
149491
3797
82
27
Updatedpostcss@^8.4.19