add initial marp implementation with sample content and build configuration
This commit is contained in:
74
node_modules/@marp-team/marpit/lib/postcss/printable.js
generated
vendored
Normal file
74
node_modules/@marp-team/marpit/lib/postcss/printable.js
generated
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.printable = exports.postprocess = exports.default = void 0;
|
||||
var _postcss_plugin = _interopRequireDefault(require("../helpers/postcss_plugin"));
|
||||
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
||||
/** @module */
|
||||
|
||||
const marpitPrintContainerStyle = `
|
||||
html, body {
|
||||
background-color: #fff;
|
||||
margin: 0;
|
||||
page-break-inside: avoid;
|
||||
break-inside: avoid-page;
|
||||
}
|
||||
`.trim();
|
||||
|
||||
/**
|
||||
* Marpit PostCSS printable plugin.
|
||||
*
|
||||
* Make printable slide deck as PDF.
|
||||
*
|
||||
* @param {Object} opts
|
||||
* @param {string} opts.width
|
||||
* @param {string} opts.height
|
||||
* @function printable
|
||||
*/
|
||||
const printable = exports.printable = (0, _postcss_plugin.default)('marpit-postcss-printable', opts => css => {
|
||||
css.walkAtRules('media', rule => {
|
||||
if (rule.params === 'marpit-print') rule.remove();
|
||||
});
|
||||
css.first.before(`
|
||||
@page {
|
||||
size: ${opts.width} ${opts.height};
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
@media marpit-print {
|
||||
section {
|
||||
page-break-before: always;
|
||||
break-before: page;
|
||||
}
|
||||
|
||||
section, section * {
|
||||
-webkit-print-color-adjust: exact !important;
|
||||
animation-delay: 0s !important;
|
||||
animation-duration: 0s !important;
|
||||
color-adjust: exact !important;
|
||||
print-color-adjust: exact !important;
|
||||
transition: none !important;
|
||||
}
|
||||
|
||||
:marpit-container > svg[data-marpit-svg] {
|
||||
display: block;
|
||||
height: 100vh;
|
||||
width: 100vw;
|
||||
}
|
||||
}
|
||||
`.trim());
|
||||
});
|
||||
|
||||
/**
|
||||
* The post-process PostCSS plugin of Marpit printable plugin.
|
||||
*
|
||||
* @function postprocess
|
||||
*/
|
||||
const postprocess = exports.postprocess = (0, _postcss_plugin.default)('marpit-postcss-printable-postprocess', () => css => css.walkAtRules('media', rule => {
|
||||
if (rule.params !== 'marpit-print') return;
|
||||
rule.params = 'print';
|
||||
rule.first.before(marpitPrintContainerStyle);
|
||||
}));
|
||||
var _default = exports.default = printable;
|
||||
Reference in New Issue
Block a user