1
0

add initial marp implementation with sample content and build configuration

This commit is contained in:
2025-09-13 18:13:22 +02:00
parent dcacc9b409
commit e5f219507f
10319 changed files with 1402023 additions and 0 deletions

21
node_modules/@marp-team/marp-cli/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2018 Marp team (marp-team@marp.app)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

838
node_modules/@marp-team/marp-cli/README.md generated vendored Normal file
View File

@@ -0,0 +1,838 @@
# @marp-team/marp-cli
[![CircleCI](https://img.shields.io/circleci/project/github/marp-team/marp-cli/main.svg?style=flat-square&logo=circleci)](https://circleci.com/gh/marp-team/marp-cli/)
[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/marp-team/marp-cli/test-win.yml?branch=main&style=flat-square&logo=github)](https://github.com/marp-team/marp-cli/actions?query=workflow%3A%22Test+for+Windows%22+branch%3Amain)
[![Codecov](https://img.shields.io/codecov/c/github/marp-team/marp-cli/main.svg?style=flat-square&logo=codecov)](https://codecov.io/gh/marp-team/marp-cli)
[![npm](https://img.shields.io/npm/v/@marp-team/marp-cli.svg?style=flat-square&logo=npm)](https://www.npmjs.com/package/@marp-team/marp-cli)
[![Docker](https://img.shields.io/docker/pulls/marpteam/marp-cli.svg?logo=docker&style=flat-square)](https://hub.docker.com/r/marpteam/marp-cli/)
[![LICENSE](https://img.shields.io/github/license/marp-team/marp-cli.svg?style=flat-square)](./LICENSE)
**A CLI interface, for [Marp](https://github.com/marp-team/marp)** (using [@marp-team/marp-core](https://github.com/marp-team/marp-core)) and any slide deck converter based on [Marpit](https://marpit.marp.app/) framework.
It can convert Marp / Marpit Markdown files into static HTML / CSS, PDF, PowerPoint document, and image(s) easily.
<p align="center">
<img src="https://raw.githubusercontent.com/marp-team/marp-cli/main/docs/images/marp-cli.gif" />
</p>
## Try it now!
### npx
[npx (`npm exec`)](https://docs.npmjs.com/cli/commands/npx) is the best way to use the latest Marp CLI if you wanted
one-shot Markdown conversion _without install_. Just run below if you have
installed [Node.js](https://nodejs.org/) v18 and later.
```bash
# Convert slide deck into HTML
npx @marp-team/marp-cli@latest slide-deck.md
npx @marp-team/marp-cli@latest slide-deck.md -o output.html
# Convert slide deck into PDF
npx @marp-team/marp-cli@latest slide-deck.md --pdf
npx @marp-team/marp-cli@latest slide-deck.md -o output.pdf
# Convert slide deck into PowerPoint document (PPTX)
npx @marp-team/marp-cli@latest slide-deck.md --pptx
npx @marp-team/marp-cli@latest slide-deck.md -o output.pptx
# Watch mode
npx @marp-team/marp-cli@latest -w slide-deck.md
# Server mode (Pass directory to serve)
npx @marp-team/marp-cli@latest -s ./slides
```
> [!IMPORTANT]
> You have to install any one of [Google Chrome], [Microsoft Edge], or [Mozilla Firefox] to convert slide deck into PDF, PPTX, and image(s).
[google chrome]: https://www.google.com/chrome/
[microsoft edge]: https://www.microsoft.com/edge
[mozilla firefox]: https://www.mozilla.org/firefox/new/
### Container image
Don't you like installing Node.js and Chrome to local? We have an official container image that is ready to use CLI.
[**⏩ Please refer how to use at Docker Hub.**][marp-cli-docker]
[marp-cli-docker]: https://hub.docker.com/r/marpteam/marp-cli/
#### [Docker Hub][marp-cli-docker]
```bash
docker pull marpteam/marp-cli
```
#### [GitHub Container Registry](https://github.com/marp-team/marp-cli/pkgs/container/marp-cli)
```bash
docker pull ghcr.io/marp-team/marp-cli
```
## Install
### Use package manager
You can use the package manager to install and update Marp CLI easily.
_Disclaimer: Package manifests are maintained by the community, not Marp team._
<!-- For contributors: This section describes only package managers that Marp manifest has been actively maintained. Each tools are following update within a few days of the latest CLI update. -->
#### macOS: **[Homebrew](https://brew.sh/)**
```bash
brew install marp-cli
```
<!-- https://github.com/Homebrew/homebrew-core/blob/master/Formula/m/marp-cli.rb -->
#### Windows: **[Scoop](https://scoop.sh/)**
```cmd
scoop install marp
```
<!-- https://github.com/ScoopInstaller/Main/blob/master/bucket/marp.json -->
### Local installation
We recommend to install Marp CLI into your Node.js project. You may control the CLI version (and engine if you want) exactly.
```bash
npm install --save-dev @marp-team/marp-cli
```
The installed `marp` command is available in [npm-scripts](https://docs.npmjs.com/misc/scripts) or `npx marp`.
> [!NOTE]
> Marp CLI is working only with [actively supported Node.js versions](https://endoflife.date/nodejs), so Node.js v18 and later is required when installing into your Node.js project.
#### Global installation
You can install with `-g` option if you want to use `marp` command globally.
```bash
npm install -g @marp-team/marp-cli
```
### [Standalone binary][releases]
We also provide standalone binaries for Linux, macOS (Apple Silicon), and Windows. These have bundled Marp CLI with Node.js binary, so no need to install Node.js separately.
**[⏩ Download the latest standalone binary from release page.][releases]**
[releases]: https://github.com/marp-team/marp-cli/releases
## Basic usage
> [!IMPORTANT]
> Several kind of conversions with 🌐 icon require to install any of compatible browsers, [Google Chrome], [Microsoft Edge], or [Mozilla Firefox]. When an unexpected problem has occurred while converting, please update your browser to the latest version. Check out [browser options](#browser-options) too.
### Convert to HTML
The passed markdown will be converted to HTML file by default. In the below example, a converted `slide-deck.html` will output to the same directory.
```bash
marp slide-deck.md
```
You can change the output path by `--output` (`-o`) option.
```bash
marp slide-deck.md -o output.html
```
Marp CLI supports converting multiple files by passing multiple paths, directories, and glob patterns. In this case, `--output` option cannot use.
When you want to output the converted result to another directory with keeping the origin directory structure, you can use `--input-dir` (`-I`) option. `--output` option would be available for specify the output directory.
### Convert to PDF (`--pdf`) 🌐
If you passed `--pdf` option or the output filename specified by `--output` (`-o`) option ends with `.pdf`, Marp CLI will try to convert Markdown into PDF file through the browser.
```bash
marp --pdf slide-deck.md
marp slide-deck.md -o converted.pdf
```
#### PDF output options
- **`--pdf-notes`**: Add PDF note annotations to the lower left when the slide page has [Marpit presenter notes].
- **`--pdf-outlines`**: Add PDF outlines/bookmarks.
`--pdf-outlines` will make outlines based on slide pages and Markdown headings by default. If necessary, you may prevent making outlines from one of them, by setting `--pdf-outlines.pages=false` or `--pdf-outlines.headings=false`.
<p align="center">
<img src="https://raw.githubusercontent.com/marp-team/marp-cli/main/docs/images/pdf-output-options.png" width="500" />
</p>
[marpit presenter notes]: https://marpit.marp.app/usage?id=presenter-notes
### Convert to PowerPoint document (`--pptx`) 🌐
Do you want more familiar way to present and share your deck? PPTX conversion to create PowerPoint document is available by passing `--pptx` option or specify the output path with PPTX extension.
```bash
marp --pptx slide-deck.md
marp slide-deck.md -o converted.pptx
```
A created PPTX includes rendered Marp slide pages and the support of [Marpit presenter notes]. It can open with PowerPoint, Keynote, Google Slides, LibreOffice Impress, and so on...
<p align="center">
<img src="https://raw.githubusercontent.com/marp-team/marp-cli/main/docs/images/pptx.png" height="300" />
</p>
#### _[EXPERIMENTAL]_ Generate editable pptx (`--pptx-editable`)
A converted PPTX usually consists of pre-rendered background images, that is meaning **contents cannot to modify or re-use** in PowerPoint. If you want to generate editable PPTX for modifying texts, shapes, and images in GUI, you can pass `--pptx-editable` option together with `--pptx` option.
```bash
marp --pptx --pptx-editable slide-deck.md
```
> [!IMPORTANT]
>
> The experimental `--pptx-editable` option requires installing both of the browser and [LibreOffice Impress](https://www.libreoffice.org/).
>
> If the theme and inline styles are providing complex styles into the slide, **`--pptx-editable` may throw an error or output the incomplete result.** (e.g. `gaia` theme in Marp Core)
> [!WARNING]
>
> Conversion to the editable PPTX results in **lower slide reproducibility compared to the conversion into regular PPTX and other formats.** Additionally, **presenter notes are not supported.** _We do not recommend to export the editable PPTX if maintaining the slide's appearance is important._
### Convert to PNG/JPEG image(s) 🌐
#### Multiple images (`--images`)
You can convert the slide deck into multiple images when specified `--images [png|jpeg]` option.
```bash
# Convert into multiple PNG image files
marp --images png slide-deck.md
# Convert into multiple JPEG image files
marp --images jpeg slide-deck.md
```
Output files have a suffix of page number, like `slide-deck.001.png`, `slide-deck.002.png`, and so on.
#### Title slide (`--image`)
When you passed `--image` option or specified the output path with PNG/JPEG extension, Marp CLI will convert _only the first page (title slide)_ of the targeted slide deck into an image.
```bash
# Convert the title slide into an image
marp --image png slide-deck.md
marp slide-deck.md -o output.png
```
It would be useful for creating [Open Graph] image that can specify with [`image` global directive and `--og-image` option](#metadata).
#### Scale factor
You can set the scale factor for rendered image(s) through `--image-scale` option. It is useful for making high-resolution image from the slide.
```bash
# Generate high-resolution image of the title slide
marp slide-deck.md -o title-slide@2x.png --image-scale 2
```
> [!TIP]
>
> `--image-scale` is not affect to the actual size of presentation.
>
> The scale factor is also available for PPTX conversion. By default, Marp CLI will use `2` as the default scale factor in PPTX, to suppress deterioration of slide rendering in full-screen presentation.
### Export presenter notes (`--notes`)
You can export [presenter notes][marpit presenter notes] in Marp / Marpit Markdown as a text file by using `--notes` option or specifying the output path with TXT extension.
```bash
# Export presenter notes as a text
marp --notes slide-deck.md
marp slide-deck.md -o output.txt
```
### Security about local files
Because of [the security reason](https://github.com/marp-team/marp-cli/pull/10#user-content-security), **conversion that is using the browser cannot use local files by default.**
Marp CLI would output incomplete result with warning if the blocked local file accessing is detected. We recommend uploading your assets to online.
If you really need to use local files in these conversion, `--allow-local-files` option helps to find your local files. _Please use only to the trusted Markdown because there is a potential security risk._
```bash
marp --pdf --allow-local-files slide-deck.md
```
## Conversion modes
### Parallelism
When converting multiple files, Marp CLI will process them in parallel with 5 concurrency by default. You can set the number of concurrency by `--parallel` (`-P`) option, or disable parallelism by `--no-parallel`.
### Watch mode (`--watch` / `-w`) <a name="watch-mode"></a>
Marp CLI will observe a change of Markdown and using theme CSS when passed with `--watch` (`-w`) option. The conversion will be triggered whenever the content of file is updated.
While you are opening the converted HTML in browser, it would refresh the opened page automatically.
### Server mode (`--server` / `-s`)
Server mode supports on-demand conversion by HTTP request. We require to pass `--server` (`-s`) option and a directory to serve.
<p align="center">
<img src="https://raw.githubusercontent.com/marp-team/marp-cli/main/docs/images/server-mode.gif" />
</p>
In this mode, the converted file outputs as the result of accessing to server, and not to disk.
You would get the converted PDF, PPTX, PNG, JPEG, and TXT by adding corresponded query string when requesting. e.g. `http://localhost:8080/deck-a.md?pdf` returns converted PDF.
> [!TIP]
>
> You can set the server port by setting the environment variable `PORT`. For example, `PORT=5000 marp -s ./slides` would listen on port number 5000.
#### `index.md` / `PITCHME.md`
Marp CLI server will provide the list of served files by default, but you can place the default Markdown deck like a common web server's `index.html`.
Place Markdown named `index.md` or `PITCHME.md` ([GitPitch style](https://gitpitch.github.io/gitpitch/#/conventions/pitchme-md)) to served directory. It would be redirected just accessing to `http://localhost:8080/`.
### Preview window (`--preview` / `-p`)
When conversions were executed together with `--preview` (`-p`) option, Marp CLI will open preview window(s) to check the converted result immediately.
Unlike opening with browser, you may present deck with the immersive window.
[Watch mode](#watch-mode) is automatically enabled while using preview window.
> [!NOTE]
>
> `--preview` option cannot use when you are using Marp CLI through official Docker image.
## Browser options
### Choose browser (`--browser`)
You can specify the kind of browser for conversion by `--browser` option. Available browsers are `chrome`, `edge`, and `firefox`. If set comma-separated browsers, Marp CLI will try to use the first available browser among them.
```bash
# Use Firefox for image conversion
marp --browser firefox ./slide.md -o slide.png
# Prefer to use Firefox first, then Chrome
marp --browser firefox,chrome ./slide.md -o slide.png
```
The default is a special value `auto`, which means to use the first available browser from `chrome,edge,firefox`.
> [!WARNING]
>
> _Firefox support is still early stage._ The PDF output generated by Firefox may include some incompatible renderings compared to the PDF generated by Chrome.
### Browser path (`--browser-path`)
If you have a browser binary that cannot find out by Marp CLI automatically, you can explicitly set the path to the browser executable through `--browser-path` option.
```bash
# Use Chromium-flavored browser (Chromium, Brave, Vivaldi, etc...)
marp --browser-path /path/to/chromium-flavored-browser ./slide.md -o slide.pdf
# Use Firefox with explicitly set path
marp --browser firefox --browser-path /path/to/firefox ./slide.md -o slide.png
```
### Other browser options
- **`--browser-protocol`**: Set the preferred protocol for connecting to the browser.
- `cdp`: [Chrome DevTools Protocol][cdp] (default)
- `webdriver-bidi`: [WebDriver BiDi]
- **`--browser-timeout`**: Set the timeout for each browser operation in seconds. (default: `30` seconds)
[cdp]: https://chromedevtools.github.io/devtools-protocol/
[webdriver bidi]: https://w3c.github.io/webdriver-bidi/
## Template
You can choose a built-in HTML templates by `--template` option. Default template is `bespoke`.
```bash
marp --template bespoke slide-deck.md
```
### `bespoke` template (default)
The `bespoke` template is using [Bespoke.js](https://github.com/bespokejs/bespoke) as the name implies. It has several features to be useful in a real presentation. A few features may control by CLI options.
#### Features
- **Navigation**: Navigate the deck through keyboard and swipe geasture.
- **Fullscreen**: Toggle fullscreen by hitting <kbd>f</kbd> / <kbd>F11</kbd> key.
- **On-screen controller**: There is a touch-friendly OSC. You may also disable by `--bespoke.osc=false` if unnecessary.
- **Fragmented list**: Recognize [Marpit's fragmented list](https://github.com/marp-team/marpit/issues/145) and appear list one-by-one if used `*` and `1)` as the bullet marker.
- **Presenter view**: Open presenter view in external window by hitting <kbd>p</kbd> key. (It may become disabled when not fulfilled requirements for working)
- **Progress bar** (optional): By setting `--bespoke.progress` option, you can add a progress bar on the top of the deck.
- [**Slide transitions**][transitions]: Support transitions (`transition` local directive) powered by [View Transition API].
[transitions]: ./docs/bespoke-transitions/README.md
[view transition api]: https://www.w3.org/TR/css-view-transitions-1/
#### Docs
- **[Slide transitions in `bespoke` template][transitions]**<br />
Learn all about of slide transitions for `bespoke` template: Built-in transitions, custom transitions, and morphing animations.
<p align="center">
<a href="./docs/bespoke-transitions/README.md">
<img src="https://raw.githubusercontent.com/marp-team/marp-cli/main/docs/bespoke-transitions/images/morphing-animation.gif" width="320" />
</a>
</p>
### `bare` template
The `bare` template is a primitive template, and there is no extra features. It only has minimum assets to give your presentation with browser.
#### Zero-JS slide deck
When [the conversion engine is changed to Marpit framework by setting `engine` option](#use-marpit-framework), _it would not use any scripts._ Even then, it has enough to use for the browser-based presentation.
```bash
marp --template bare --engine @marp-team/marpit slide-deck.md
```
## Metadata
Through [global directives] or CLI options, you can set metadata for a converted HTML, PDF, and PPTX slide deck.
| [Global directives] | CLI option | Description | Available in |
| :-----------------: | :-------------: | :------------------------------ | :-------------- |
| `title` | `--title` | Define title of the slide deck | HTML, PDF, PPTX |
| `description` | `--description` | Define description of the slide | HTML, PDF, PPTX |
| `author` | `--author` | Define author of the slide deck | HTML, PDF, PPTX |
| `keywords` | `--keywords` | Define comma-separated keywords | HTML, PDF |
| `url` | `--url` | Define [canonical URL] | HTML |
| `image` | `--og-image` | Define [Open Graph] image URL | HTML |
[canonical url]: https://en.wikipedia.org/wiki/Canonical_link_element
[open graph]: http://ogp.me/
When a title was not defined, Marp CLI may assign the title from the first heading of Markdown automatically. If not wanted this detection, specify the title as empty string `""`.
### By [global directives]
Marp CLI supports _additional [global directives]_ to specify metadata in Markdown. You can define meta values in Markdown front-matter.
```markdown
---
title: Marp slide deck
description: An example slide deck created by Marp CLI
author: Yuki Hattori
keywords: marp,marp-cli,slide
url: https://marp.app/
image: https://marp.app/og-image.jpg
---
# Marp slide deck
```
[global directives]: https://marpit.marp.app/directives?id=global-directives-1
### By CLI option
Marp CLI prefers CLI option to global directives. You can override metadata values by `--title`, `--description`, `--author`, `--keywords`, `--url`, and `--og-image`.
## Theme
### Override theme
You can override theme you want to use by `--theme` option. For example to use [Gaia](https://github.com/marp-team/marp-core/tree/main/themes#gaia) built-in theme in Marp Core:
```bash
marp --theme gaia
```
### Use custom theme
A custom theme created by user also can use easily by passing the path of CSS file.
```bash
marp --theme custom-theme.css
```
> [!TIP]
>
> [Marpit theme CSS requires `@theme` meta comment](https://marpit.marp.app/theme-css?id=metadata) in regular use, but it's not required in this usage.
### Theme set
`--theme-set` option has to specify theme set composed by multiple theme CSS files. The registered themes are usable in [Marpit's `theme` directive](https://marpit.marp.app/directives?id=theme).
```bash
# Multiple theme CSS files
marp --theme-set theme-a.css theme-b.css theme-c.css -- deck-a.md deck-b.md
# Theme directory
marp --theme-set ./themes -- deck.md
```
## Engine
Marp CLI is calling the [Marpit framework](https://marpit.marp.app/) based converter as "Engine". Normally we use the bundled [Marp Core](https://github.com/marp-team/marp-core), but you may swap the conversion engine to another Marpit based engine through `--engine` option.
You can use Marp (and compatible markdown-it) plugins while converting, or completely swap the converter to the other Marpit-based engine which published to npm.
### Use Marpit framework
For example, you can convert Markdown with using the pure Marpit framework.
```bash
# Install Marpit framework
npm i @marp-team/marpit
# Specify engine to use Marpit
marp --engine @marp-team/marpit marpit-deck.md
```
Notice that Marpit has not provided theme. It would be good to include inline style in Markdown, or pass CSS file by `--theme` option.
> [!TIP]
>
> If you want to use the Marpit-based custom engine by the module name, the specified module must be exporting a class inherited from Marpit as the default export.
### Functional engine
When you specified the path to JavaScript file (`.js`, `.cjs`, or `.mjs`) in `--engine` option, you may use more customized engine by a JavaScript function.
#### Spec
The functional engine should export a function as the default export, which should have a single argument representing [the constructor option of Marpit](https://marpit-api.marp.app/marpit)/[Marp Core](https://github.com/marp-team/marp-core#constructor-options).
The function must return a class inherited from Marpit, or an instance of Marpit-based engine made by the parameter passed by argument.
```javascript
// engine.mjs (ES modules)
import { MarpitBasedEngine } from 'marpit-based-engine'
export default () => MarpitBasedEngine // Return a class inherited from Marpit
```
```javascript
// engine.cjs (CommonJS)
const { MarpitBasedEngine } = require('marpit-based-engine')
module.exports = function (constructorOptions) {
// Return an instance of Marpit initialized by passed constructor options
return new MarpitBasedEngine(constructorOptions)
}
```
This function can return [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) object so you can use [async function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function) too.
```javascript
export default async (constructorOptions) => {
const { MarpitBasedEngine } = await import('marpit-based-engine')
return new MarpitBasedEngine(constructorOptions)
}
```
> [!WARNING]
>
> Currently ES Modules can resolve only when using Marp CLI via Node.js. [The standalone binary](#standalone-binary) cannot resolve ESM. ([vercel/pkg#1291](https://github.com/vercel/pkg/issues/1291))
#### `marp` getter property
Marp CLI also exposes `marp` getter property to the parameter. It returns a prepared instance of the built-in Marp Core engine, so you can apply several customizations to Marp engine with simple declarations.
```javascript
const marpPlugin = require('marp-plugin-foo')
const andMorePlugin = require('marp-plugin-bar')
module.exports = ({ marp }) => marp.use(marpPlugin).use(andMorePlugin)
```
It allows converting Markdown with additional syntaxes that were provided by Marp (or compatible markdown-it) plugins.
#### Example: [markdown-it-mark](https://github.com/markdown-it/markdown-it-mark)
```javascript
// engine.mjs
import markdownItMark from 'markdown-it-mark'
export default ({ marp }) => marp.use(markdownItMark)
```
```bash
# Install markdown-it-mark into your project
npm i markdown-it-mark --save
# Specify the path to functional engine
marp --engine ./engine.mjs slide-deck.md
```
The customized engine will convert `==marked==` to `<mark>marked</mark>`.
### Confirm engine version
By using `--version` (`-v`) option, you may confirm the version of engine that is expected to use in current configuration.
```console
$ marp --version
@marp-team/marp-cli v4.x.x (w/ @marp-team/marp-core v4.x.x)
```
### Use specific version of Marp Core
Marp CLI prefers to use _an installed core to local project by user_ than the bundled.
If the current project has installed `@marp-team/marp-core` individually, it would show its version and the annotation: `w/ user-installed @marp-team/marp-core vX.X.X` or `w/ customized engine`.
```console
$ npm i @marp-team/marp-cli @marp-team/marp-core@^4.0.0 --save-dev
$ npx marp --version
@marp-team/marp-cli v4.x.x (w/ user-installed @marp-team/marp-core v4.0.0)
```
## Configuration file
Marp CLI can be configured options with file, such as `marp.config.js`, `marp.config.mjs` (ES Modules), `marp.config.cjs` (CommonJS), `.marprc` (JSON / YAML), and `marp` section of `package.json`.
It is useful to configure settings for the whole of project.
```javascript
// package.json
{
"marp": {
"inputDir": "./slides",
"output": "./public",
"themeSet": "./themes"
}
}
```
```yaml
# .marprc.yml
allowLocalFiles: true
options:
looseYAML: false
markdown:
breaks: false
pdf: true
```
```javascript
// marp.config.mjs
import markdownItContainer from 'markdown-it-container'
export default {
// Customize engine on configuration file directly
engine: ({ marp }) => marp.use(markdownItContainer, 'custom'),
}
```
By default we use configuration file that is placed on current directory, but you may also specify the path for a configuration file by `--config-file` (`--config` / `-c`) option.
If you want to prevent looking up a configuration file, you can pass `--no-config-file` (`--no-config`) option.
> [!WARNING]
>
> Currently ES Modules can resolve only when using Marp CLI via Node.js. [The standalone binary](#standalone-binary) cannot resolve ESM. ([vercel/pkg#1291](https://github.com/vercel/pkg/issues/1291))
### Options
| Key | Type | CLI option | Description |
| :---------------- | :-------------------------: | :-----------------------: | :---------------------------------------------------------------------------------------------------------- |
| `allowLocalFiles` | boolean | `--allow-local-files` | Allow to access local files from Markdown while converting PDF _(NOT SECURE)_ |
| `author` | string | `--author` | Define author of the slide deck |
| `bespoke` | object | | Setting options for `bespoke` template |
| ┗ `osc` | boolean | `--bespoke.osc` | \[Bespoke\] Use on-screen controller (`true` by default) |
| ┗ `progress` | boolean | `--bespoke.progress` | \[Bespoke\] Use progress bar (`false` by default) |
| ┗ `transition` | boolean | `--bespoke.transition` | \[Bespoke\] Use [transitions] (Only in browsers supported [View Transition API]: `true` by default) |
| `browser` | string \| string[] | `--browser` | The kind of browser for conversion (`auto` by default) |
| `browserPath` | string | `--browser-path` | Path to the browser executable |
| `browserProtocol` | `cdp` \| `webdriver-bidi` | `--browser-protocol` | Set the preferred protocol for connecting to the browser (`cdp` by default) |
| `browserTimeout` | number | `--browser-timeout` | Set the timeout for each browser operation in seconds (`30` by default) |
| `description` | string | `--description` | Define description of the slide deck |
| `engine` | string \| Class \| Function | `--engine` | Specify Marpit based engine |
| `html` | boolean \| object | `--html` | Enable or disable HTML tags (Configuration file can pass [the whitelist object] if you are using Marp Core) |
| `image` | `png` \| `jpeg` | `--image` | Convert the first slide page into an image file |
| `images` | `png` \| `jpeg` | `--images` | Convert slide deck into multiple image files |
| `imageScale` | number | `--image-scale` | The scale factor for rendered images (`1` by default, or `2` for PPTX conversion) |
| `inputDir` | string | `--input-dir` `-I` | The base directory to find markdown and theme CSS |
| `jpegQuality` | number | `--jpeg-quality` | Setting JPEG image quality (`85` by default) |
| `keywords` | string \| string[] | `--keywords` | Define keywords for the slide deck (Accepts comma-separated string and array of string) |
| `lang` | string | | Define the language of converted HTML |
| `notes` | boolean | `--notes` | Convert slide deck notes into a text file |
| `ogImage` | string | `--og-image` | Define [Open Graph] image URL |
| `options` | object | | The base options for the constructor of engine |
| `output` | string | `--output` `-o` | Output file path (or directory when input-dir is passed) |
| `parallel` | boolean \| number | `--parallel` `-P` | Set the number of concurrency for parallel conversion (`5` by default) |
| `pdf` | boolean | `--pdf` | Convert slide deck into PDF |
| `pdfNotes` | boolean | `--pdf-notes` | Add [presenter notes][marpit presenter notes] to PDF as annotations |
| `pdfOutlines` | boolean \| object | `--pdf-outlines` | Add outlines (bookmarks) to PDF |
| ┗ `pages` | boolean | `--pdf-outlines.pages` | Make PDF outlines from slide pages (`true` by default when `pdfOutlines` is enabled) |
| ┗ `headings` | boolean | `--pdf-outlines.headings` | Make PDF outlines from Markdown headings (`true` by default when `pdfOutlines` is enabled) |
| `pptx` | boolean | `--pptx` | Convert slide deck into PowerPoint document |
| `pptxEditable` | boolean | `--pptx-editable` | _[EXPERIMENTAL]_ Generate editable PPTX when converting to PPTX |
| `preview` | boolean | `--preview` `-p` | Open preview window |
| `server` | boolean | `--server` `-s` | Enable server mode |
| `template` | `bare` \| `bespoke` | `--template` | Choose template (`bespoke` by default) |
| `theme` | string | `--theme` | Override theme by name or CSS file |
| `themeSet` | string \| string[] | `--theme-set` | Path to additional theme CSS files |
| `title` | string | `--title` | Define title of the slide deck |
| `url` | string | `--url` | Define [canonical URL] |
| `watch` | boolean | `--watch` `-w` | Watch input markdowns for changes |
[the whitelist object]: https://github.com/marp-team/marp-core#html-boolean--object
Some of options that cannot specify through CLI options can be configured by file. (e.g. `options` field for the constructor option of used engine)
<details>
<summary>Example: Customize engine's constructor option</summary>
You can fine-tune constructor options for the engine, [Marp Core](https://github.com/marp-team/marp-core#constructor-options) / [Marpit](https://marpit-api.marp.app/marpit).
```json
{
"options": {
"markdown": {
"breaks": false
},
"minifyCSS": false
}
}
```
This configuration will set the constructor option for Marp Core as specified:
- Disables [Marp Core's line breaks conversion](https://github.com/marp-team/marp-core#marp-markdown) (`\n` to `<br />`) to match for CommonMark, by passing [markdown-it's `breaks` option](https://markdown-it.github.io/markdown-it/#MarkdownIt.new) as `false`.
- Disable minification for rendered theme CSS to make debug your style easily, by passing [`minifyCSS`](https://github.com/marp-team/marp-core#minifycss-boolean) as `false`.
> [!WARNING]
>
> Some options may be overridden by used template.
</details>
### Auto completion
When Marp CLI has been installed into the local project, for getting the power of auto completion for the config, such as [IntelliSense](https://code.visualstudio.com/docs/editor/intellisense), you can annotate the config object through JSDoc, with Marp CLI's `Config` type.
```javascript
/** @type {import('@marp-team/marp-cli').Config} */
const config = {
// ...
}
export default config
```
Or you can import Vite-like `defineConfig` helper from Marp CLI instead.
```javascript
import { defineConfig } from '@marp-team/marp-cli'
export default defineConfig({
// ...
})
```
#### `Config` type with custom engine
If you've swapped the engine into another Marpit based engine, you can provide better suggestion for `options` field by passing the engine type to generics.
```javascript
/** @type {import('@marp-team/marp-cli').Config<typeof import('@marp-team/marpit').Marpit>} */
const config = {
engine: '@marp-team/marpit',
options: {
// Suggest only Marpit constructor options, not Marp Core
},
}
export default config
```
#### TypeScript (`marp.config.ts`)
If you installed `typescript` into your local project together with Marp CLI, you can write a config by TypeScript `marp.config.ts`. Marp CLI will try to transpile `.ts` with the project configuration `tsconfig.json`.
In TypeScript configuration, you can specify the custom engine as the generics for `defineConfig` helper, like this:
```typescript
// marp.config.ts
import { Marpit } from '@marp-team/marpit'
import { defineConfig } from '@marp-team/marp-cli'
export default defineConfig<typeof Marpit>({
engine: Marpit,
options: {
// Suggest only Marpit constructor options
},
})
```
## API _(EXPERIMENTAL)_
You can use Marp CLI through Node.js [if installed Marp CLI into your local project](#local-installation).
```js
const { marpCli } = require('@marp-team/marp-cli')
marpCli(['test.md', '--pdf'])
.then((exitStatus) => {
if (exitStatus > 0) {
console.error(`Failure (Exit status: ${exitStatus})`)
} else {
console.log('Success')
}
})
.catch(console.error)
```
`marpCli()` accepts an argument of CLI options as array, and returns `Promise` to resolve an expected exit status in CLI. It would be rejected with the instance of `Error` if CLI met an error to suspend the conversion process.
### Error handling
We have exported [`CLIError` class and `CLIErrorCode` enum](https://github.com/marp-team/marp-cli/blob/main/src/error.ts) from `@marp-team/marp-cli`, to allow handling for specific errors that have already known by Marp CLI.
If `CLIError` instance was thrown, you can identify the reason why CLI threw error by checking `errorCode` member.
### Wait for observation
`marpCli()` would not be resolved initiatively if started some observation: Watch mode, server mode, and preview window.
`waitForObservation()` is helpful to handle them. It returns `Promise` that would be resolved with helper object when ready to observe resources in `marpCli()`.
```javascript
const { marpCli, waitForObservation } = require('@marp-team/marp-cli')
marpCli(['--server', './slides/'])
.then((exitCode) => console.log(`Done with exit code ${exitCode}`))
.catch(console.error)
waitForObservation().then(({ stop }) => {
console.log('Observed')
// Stop observations to resolve marpCli()'s Promise
stop()
})
```
The resolved helper has `stop()` method for telling Marp CLI to stop observation and resolve `Promise`.
## 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).
## Author
Managed by [@marp-team](https://github.com/marp-team).
- <img src="https://github.com/yhatt.png" width="16" height="16"/> Yuki Hattori ([@yhatt](https://github.com/yhatt))
## License
This tool releases under the [MIT License](LICENSE).

View File

@@ -0,0 +1 @@
"use strict";exports.c=function(r){throw new Error('Could not dynamically require "'+r+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')};

2
node_modules/@marp-team/marp-cli/lib/bespoke.js generated vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,67 @@
Name: bespoke
Version: 1.2.0-dev
License: (MIT)
Private: false
Description: DIY Presentation Micro-Framework
Repository: git://github.com/bespokejs/bespoke.git
Author: Mark Dalgleish (http://markdalgleish.com)
License Copyright:
===
Copyright (c) 2014 Mark Dalgleish
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
---
Name: vhtml
Version: 2.2.0
License: MIT
Private: false
Description: Hyperscript reviver that constructs a sanitized HTML string.
Repository: git+https://github.com/developit/vhtml.git
Homepage: https://github.com/developit/vhtml
Author: Jason Miller <jason@developit.ca>
License Copyright:
===
The MIT License (MIT)
Copyright (c) 2015 Jason Miller
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

File diff suppressed because one or more lines are too long

228
node_modules/@marp-team/marp-cli/lib/index-BelEQDDf.js generated vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
"use strict";var e=require("node:process"),r=require("node:os"),i=require("node:fs"),u=require("./marp-cli-CBvmXjya.js");require("node:tty"),require("./binary-BtVxQo5V.js"),require("tty"),require("util"),require("os"),require("node:path"),require("fs"),require("fs/promises"),require("path"),require("node:child_process"),require("node:util"),require("child_process"),require("process"),require("events"),require("net"),require("puppeteer-core"),require("node:events"),require("node:util/types"),require("node:crypto"),require("yargs/yargs"),require("cosmiconfig"),require("node:url"),require("module"),require("node:assert"),require("node:module"),require("node:v8"),require("node:fs/promises"),require("stream"),require("node:stream/consumers"),require("node:timers/promises"),require("tmp"),require("@marp-team/marpit"),require("chokidar"),require("ws"),require("node:querystring"),require("serve-index"),require("@marp-team/marp-core/package.json");const s=()=>{if("linux"!==e.platform)return!1;if(r.release().toLowerCase().includes("microsoft"))return!u.i();try{return!!i.readFileSync("/proc/version","utf8").toLowerCase().includes("microsoft")&&!u.i()}catch{return!1}};var o=e.env.__IS_WSL_TEST__?s:s();exports.default=o;

1
node_modules/@marp-team/marp-cli/lib/index.js generated vendored Normal file
View File

@@ -0,0 +1 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./marp-cli-CBvmXjya.js");require("node:process"),require("node:os"),require("node:tty"),require("./binary-BtVxQo5V.js"),require("tty"),require("util"),require("os"),require("node:fs"),require("node:path"),require("fs"),require("fs/promises"),require("path"),require("node:child_process"),require("node:util"),require("child_process"),require("process"),require("events"),require("net"),require("puppeteer-core"),require("node:events"),require("node:util/types"),require("node:crypto"),require("yargs/yargs"),require("cosmiconfig"),require("node:url"),require("module"),require("node:assert"),require("node:module"),require("node:v8"),require("node:fs/promises"),require("stream"),require("node:stream/consumers"),require("node:timers/promises"),require("tmp"),require("@marp-team/marpit"),require("chokidar"),require("ws"),require("node:querystring"),require("serve-index"),require("@marp-team/marp-core/package.json");const r=e.a;exports.CLIError=e.C,exports.CLIErrorCode=e.b,exports.default=e.a,exports.waitForObservation=e.w,exports.defineConfig=e=>e,exports.marpCli=r;

File diff suppressed because one or more lines are too long

1
node_modules/@marp-team/marp-cli/lib/marp-cli.js generated vendored Executable file
View File

@@ -0,0 +1 @@
"use strict";var e=require("./marp-cli-CBvmXjya.js");require("node:process"),require("node:os"),require("node:tty"),require("./binary-BtVxQo5V.js"),require("tty"),require("util"),require("os"),require("node:fs"),require("node:path"),require("fs"),require("fs/promises"),require("path"),require("node:child_process"),require("node:util"),require("child_process"),require("process"),require("events"),require("net"),require("puppeteer-core"),require("node:events"),require("node:util/types"),require("node:crypto"),require("yargs/yargs"),require("cosmiconfig"),require("node:url"),require("module"),require("node:assert"),require("node:module"),require("node:v8"),require("node:fs/promises"),require("stream"),require("node:stream/consumers"),require("node:timers/promises"),require("tmp"),require("@marp-team/marpit"),require("chokidar"),require("ws"),require("node:querystring"),require("serve-index"),require("@marp-team/marp-core/package.json"),exports.apiInterface=e.a,exports.cliInterface=e.c,exports.marpCli=e.m,exports.waitForObservation=e.w;

1
node_modules/@marp-team/marp-cli/lib/patch.js generated vendored Normal file
View File

@@ -0,0 +1 @@
"use strict";var e=require("node:module"),r=require("./binary-BtVxQo5V.js");require("tty"),require("util"),require("os");const i=()=>{try{e.enableCompileCache?.()}catch{}},t=()=>{r.i()&&process.config.variables.icu_small&&(r.d("Using a polyfilled implementation for Intl.Segmenter."),require("@formatjs/intl-segmenter/polyfill-force"))};exports.enableCompileCache=i,exports.patch=()=>{t(),i()},exports.patchSegmenter=t;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

1
node_modules/@marp-team/marp-cli/lib/prepare.js generated vendored Normal file
View File

@@ -0,0 +1 @@
"use strict";const e="marp-cli*",s=/^(?:-d|--debug)(?:$|=)/,t=["true","1"],i=["false","0"],r=["all","full"],l=s=>{const l=s.trim(),c=l.toLowerCase();return r.includes(c)?"*":t.includes(c)?e:!i.includes(c)&&(l||e)};exports.cliPrepare=(t=process.argv.slice(2))=>{let i=!1;const r=[...t],c=r.findIndex(e=>s.test(e));if(c>=0){const s=r[c];if(s.startsWith("-d=")||s.startsWith("--debug="))i=l(s.slice(s.indexOf("=")+1)),r.splice(c,1);else{const s=r[c+1];!s||s.startsWith("-")?(i=e,r.splice(c,1)):(i=l(s),r.splice(c,2))}}return{args:r,debug:i}},exports.defaultDebug=e;

View File

@@ -0,0 +1 @@
!function(){"use strict";const e="marp-cli-show-all";!function(){const t=document.getElementById("show-all"),s=document.getElementById("index"),c=c=>{t.checked=c,s.classList.toggle("show-all",c);try{sessionStorage.setItem(e,c?"1":"")}catch(e){console.error(e)}};c(!!sessionStorage.getItem(e)),t.addEventListener("change",()=>c(t.checked))}()}();

1
node_modules/@marp-team/marp-cli/lib/watch.js generated vendored Normal file
View File

@@ -0,0 +1 @@
!function(){"use strict";const e=(n,o=!1)=>{const t=new WebSocket(n);return t.addEventListener("open",()=>{console.info("[Marp CLI] Observing the change of file..."),o&&location.reload()}),t.addEventListener("close",()=>{console.warn("[Marp CLI] WebSocket for file watcher was disconnected. Try re-connecting in 5000ms..."),setTimeout(()=>e(n,!0),5e3)}),t.addEventListener("message",e=>{"reload"===e.data&&location.reload()}),t};(()=>{const n=window.__marpCliWatchWS;n&&e(n)})()}();

15
node_modules/@marp-team/marp-cli/marp-cli.js generated vendored Executable file
View File

@@ -0,0 +1,15 @@
#!/usr/bin/env node
'use strict'
{
const prepare = require('./lib/prepare.js')
const cli = prepare.cliPrepare()
if (cli.debug)
process.env.DEBUG = `${process.env.DEBUG ? `${process.env.DEBUG},` : ''}${cli.debug}`
require('./lib/patch.js').patch()
require('./lib/marp-cli.js')
.cliInterface(cli.args)
.then((exitCode) => process.on('exit', () => process.exit(exitCode)))
}

174
node_modules/@marp-team/marp-cli/package.json generated vendored Normal file
View File

@@ -0,0 +1,174 @@
{
"name": "@marp-team/marp-cli",
"version": "4.2.3",
"description": "A CLI interface for Marp and Marpit based converters",
"license": "MIT",
"author": {
"name": "Marp team",
"url": "https://github.com/marp-team"
},
"contributors": [
{
"name": "Yuki Hattori",
"url": "https://github.com/yhatt"
}
],
"keywords": [
"marp",
"markdown",
"cli",
"slide",
"deck",
"presentation"
],
"repository": {
"type": "git",
"url": "https://github.com/marp-team/marp-cli"
},
"engines": {
"node": ">=18"
},
"main": "lib/index.js",
"types": "types/src/index.d.ts",
"files": [
"marp-cli.js",
"lib/",
"types/"
],
"bin": {
"marp": "marp-cli.js"
},
"pkg": {
"scripts": "lib/**/*.js"
},
"browserslist": [
"> 1% and last 3 versions",
"Firefox ESR"
],
"scripts": {
"build": "npm -s run clean && rollup -c",
"build:standalone": "run-s build standalone",
"check:audit": "npm audit --audit-level=moderate",
"check:format": "npm -s run format -- -c",
"check:ts": "tsc --noEmit",
"clean": "node -e \"fs.rmSync('lib',{recursive:true,force:true})\"",
"format": "prettier \"**/*.{css,js,jsx,json,md,mjs,scss,ts,tsx,yaml,yml}\"",
"format:write": "npm -s run format -- --write",
"lint:js": "eslint --cache",
"lint:css": "stylelint \"src/**/*.{css,scss}\"",
"prepack": "npm-run-all --parallel check:* lint:* test:coverage --parallel build types",
"prepare": "npx --no patch-package || exit 0",
"preversion": "run-p check:* lint:* test:coverage",
"standalone": "node -e \"fs.rmSync('bin',{recursive:true,force:true})\" && pkg -C gzip --out-path ./bin .",
"standalone:pack": "node ./scripts/pack.mjs",
"test": "jest",
"test:coverage": "jest --coverage",
"types": "node -e \"fs.rmSync('types',{recursive:true,force:true})\" && tsc --declaration --emitDeclarationOnly --outDir types",
"version": "curl https://raw.githubusercontent.com/marp-team/actions/v1/lib/scripts/version.js | node && git add -A CHANGELOG.md",
"watch": "rollup -w -c"
},
"devDependencies": {
"@babel/preset-env": "^7.28.0",
"@formatjs/intl-segmenter": "^11.7.10",
"@rollup/plugin-alias": "^5.1.1",
"@rollup/plugin-commonjs": "^28.0.6",
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-node-resolve": "^16.0.1",
"@rollup/plugin-replace": "^6.0.2",
"@rollup/plugin-terser": "^0.4.4",
"@rollup/plugin-typescript": "^12.1.4",
"@rollup/plugin-url": "^8.0.2",
"@tsconfig/node22": "^22.0.2",
"@tsconfig/recommended": "^1.0.10",
"@types/debug": "^4.1.12",
"@types/dom-view-transitions": "^1.0.6",
"@types/express": "^5.0.3",
"@types/jest": "^30.0.0",
"@types/markdown-it": "^14.1.2",
"@types/node": "~18.19.111",
"@types/pug": "^2.0.10",
"@types/supertest": "^6.0.3",
"@types/which": "^3.0.4",
"@types/ws": "^8.18.1",
"@types/yargs": "^17.0.33",
"@yao-pkg/pkg": "^6.6.0",
"autoprefixer": "^10.4.21",
"bespoke": "bespokejs/bespoke",
"chalk": "^5.4.1",
"cheerio": "^1.1.0",
"chrome-launcher": "^1.2.0",
"css.escape": "^1.5.1",
"cssnano": "^7.1.0",
"debug": "^4.4.1",
"eslint": "^9.31.0",
"eslint-config-prettier": "^10.1.8",
"eslint-import-resolver-typescript": "^4.4.4",
"eslint-plugin-import-x": "^4.16.1",
"eslint-plugin-jest": "^29.0.1",
"eslint-plugin-n": "^17.21.0",
"express": "^5.1.0",
"fast-plist": "^0.1.3",
"globals": "^16.3.0",
"globby": "~14.0.2",
"image-size": "^2.0.2",
"import-from": "^4.0.0",
"import-meta-resolve": "^4.1.0",
"is-inside-container": "^1.0.0",
"is-wsl": "^3.1.0",
"jest": "^30.0.4",
"jest-environment-jsdom": "^30.0.4",
"jest-junit": "^16.0.0",
"nanoid": "^5.1.5",
"npm-check-updates": "^18.0.1",
"npm-run-all2": "^8.0.4",
"os-locale": "^6.0.2",
"package-up": "^5.0.0",
"patch-package": "^8.0.0",
"pdf-lib": "^1.17.1",
"portfinder": "^1.0.37",
"postcss": "^8.5.6",
"postcss-url": "^10.1.3",
"pptxgenjs": "^4.0.1",
"prettier": "^3.6.2",
"pug": "^3.0.3",
"rollup": "^4.45.1",
"rollup-plugin-license": "^3.6.0",
"rollup-plugin-postcss": "^4.0.2",
"sass": "^1.89.2",
"strip-ansi": "^7.1.0",
"stylelint": "^16.22.0",
"stylelint-config-standard-scss": "^15.0.1",
"supertest": "^7.1.3",
"tar-stream": "^3.1.7",
"ts-jest": "^29.4.0",
"ts-key-enum": "^3.0.13",
"tslib": "^2.8.1",
"typed-emitter": "^2.1.0",
"typescript": "^5.8.3",
"typescript-eslint": "^8.37.0",
"vhtml": "^2.2.0",
"which": "^4.0.0",
"wrap-ansi": "^9.0.0",
"yauzl": "^3.2.0",
"zip-stream": "^7.0.2"
},
"dependencies": {
"@marp-team/marp-core": "^4.1.0",
"@marp-team/marpit": "^3.1.3",
"chokidar": "^4.0.3",
"cosmiconfig": "^9.0.0",
"puppeteer-core": "^24.16.0",
"serve-index": "^1.9.1",
"tmp": "^0.2.5",
"ws": "^8.18.3",
"yargs": "^17.7.2"
},
"overrides": {
"patch-package": {
"tmp": "^0.2.5"
}
},
"publishConfig": {
"access": "public"
}
}

View File

@@ -0,0 +1,40 @@
import type { Browser as PuppeteerBrowser, ProtocolType, LaunchOptions, Page } from 'puppeteer-core';
import type TypedEventEmitter from 'typed-emitter';
export type BrowserKind = 'chrome' | 'firefox';
export type BrowserProtocol = ProtocolType;
export interface BrowserOptions {
path: string;
timeout?: number;
}
type BrowserEvents = {
close: (browser: PuppeteerBrowser) => void;
disconnect: (browser: PuppeteerBrowser) => void;
launch: (browser: PuppeteerBrowser) => void;
};
declare const Browser_base: new () => TypedEventEmitter<BrowserEvents>;
export declare abstract class Browser extends Browser_base implements AsyncDisposable {
#private;
static readonly kind: BrowserKind;
static readonly protocol: BrowserProtocol;
path: string;
protocolTimeout: number;
timeout: number;
private _puppeteerDataDir;
private _puppeteer;
constructor(opts: BrowserOptions);
get kind(): BrowserKind;
get protocol(): ProtocolType;
launch(opts?: LaunchOptions): Promise<PuppeteerBrowser>;
withPage<T>(fn: (page: Page) => T): Promise<T>;
close(): Promise<void>;
[Symbol.asyncDispose](): Promise<void>;
browserInWSLHost(): Promise<boolean>;
resolveToFileURI(filePath: string): Promise<string>;
/** @internal Overload launch behavior in subclass */
protected abstract launchPuppeteer(opts: LaunchOptions): Promise<PuppeteerBrowser>;
/** @internal */
protected generateLaunchOptions(mergeOptions?: LaunchOptions): Promise<LaunchOptions>;
/** @internal */
protected puppeteerDataDir(): Promise<string>;
}
export {};

View File

@@ -0,0 +1,7 @@
import type { LaunchOptions } from 'puppeteer-core';
import { BrowserProtocol } from '../browser';
import { ChromeBrowser } from './chrome';
export declare class ChromeCdpBrowser extends ChromeBrowser {
static readonly protocol: BrowserProtocol;
protected launchPuppeteer(opts: LaunchOptions): Promise<import("puppeteer-core").Browser>;
}

View File

@@ -0,0 +1,13 @@
import type { Browser as PuppeteerBrowser, LaunchOptions } from 'puppeteer-core';
import { Browser } from '../browser';
import type { BrowserKind, BrowserProtocol } from '../browser';
export declare class ChromeBrowser extends Browser {
static readonly kind: BrowserKind;
static readonly protocol: BrowserProtocol;
protected launchPuppeteer(opts: Omit<LaunchOptions, 'userDataDir'>): Promise<PuppeteerBrowser>;
private puppeteerArgs;
private puppeteerArgsEnableSandbox;
private puppeteerArgsEnableGPU;
private puppeteerPipe;
private puppeteerHeadless;
}

View File

@@ -0,0 +1,8 @@
import type { Browser as PuppeteerBrowser, LaunchOptions } from 'puppeteer-core';
import { Browser } from '../browser';
import type { BrowserKind, BrowserProtocol } from '../browser';
export declare class FirefoxBrowser extends Browser {
static readonly kind: BrowserKind;
static readonly protocol: BrowserProtocol;
protected launchPuppeteer(opts: LaunchOptions): Promise<PuppeteerBrowser>;
}

View File

@@ -0,0 +1,19 @@
import type { Browser } from './browser';
export interface BrowserFinderResult {
path: string;
acceptedBrowsers: (typeof Browser)[];
}
export interface BrowserFinderOptions {
preferredPath?: string;
}
export type BrowserFinder = (opts: BrowserFinderOptions) => Promise<BrowserFinderResult>;
export type FinderName = keyof typeof availableFindersMap;
declare const availableFindersMap: {
readonly chrome: BrowserFinder;
readonly edge: BrowserFinder;
readonly firefox: BrowserFinder;
};
export declare const availableFinders: readonly FinderName[];
export declare const defaultFinders: readonly ["chrome", "edge", "firefox"];
export declare const findBrowser: (finders?: readonly FinderName[], opts?: BrowserFinderOptions) => Promise<BrowserFinderResult>;
export {};

View File

@@ -0,0 +1,2 @@
import type { BrowserFinder } from '../finder';
export declare const chromeFinder: BrowserFinder;

View File

@@ -0,0 +1,2 @@
import type { BrowserFinder } from '../finder';
export declare const edgeFinder: BrowserFinder;

View File

@@ -0,0 +1,2 @@
import type { BrowserFinder } from '../finder';
export declare const firefoxFinder: BrowserFinder;

View File

@@ -0,0 +1,30 @@
import type { Browser, BrowserProtocol } from './browser';
import { ChromeCdpBrowser } from './browsers/chrome-cdp';
import type { BrowserFinderResult, FinderName } from './finder';
export interface BrowserManagerConfig {
/** Browser finders */
finders?: FinderName | FinderName[];
/** Preferred path */
path?: string;
/** Preferred protocol */
protocol?: BrowserProtocol;
/** Timeout for browser operations */
timeout?: number;
}
export declare class BrowserManager implements AsyncDisposable {
private _finders;
private _finderPreferredPath?;
private _finderResult;
private _conversionBrowser;
private _preferredProtocol;
private _previewBrowser;
private _timeout?;
constructor(config?: BrowserManagerConfig);
get timeout(): number | undefined;
configure(config: BrowserManagerConfig): void;
findBrowser(): Promise<BrowserFinderResult>;
browserForConversion(): Promise<Browser>;
browserForPreview(): Promise<ChromeCdpBrowser>;
dispose(): Promise<void>;
[Symbol.asyncDispose](): Promise<void>;
}

8
node_modules/@marp-team/marp-cli/types/src/cli.d.ts generated vendored Normal file
View File

@@ -0,0 +1,8 @@
interface CLIOption {
singleLine?: boolean;
}
export declare function silence(value: boolean): void;
export declare function info(message: string, opts?: CLIOption): void;
export declare function warn(message: string, opts?: CLIOption): void;
export declare function error(message: string, opts?: CLIOption): void;
export {};

126
node_modules/@marp-team/marp-cli/types/src/config.d.ts generated vendored Normal file
View File

@@ -0,0 +1,126 @@
import type { FinderName } from './browser/finder';
import { ConvertType, type ConverterOption } from './converter';
import { ResolvableEngine, ResolvedEngine } from './engine';
import { TemplateOption } from './templates';
import { ThemeSet } from './theme';
type Overwrite<T, U> = Omit<T, Extract<keyof T, keyof U>> & U;
interface IMarpCLIArguments {
_?: string[];
allowLocalFiles?: boolean;
author?: string;
baseUrl?: string;
'bespoke.osc'?: boolean;
'bespoke.progress'?: boolean;
'bespoke.transition'?: boolean;
browser?: string | string[];
browserPath?: string;
browserProtocol?: string;
browserTimeout?: number;
configFile?: string | false;
description?: string;
engine?: string;
html?: boolean;
image?: string;
images?: string;
imageScale?: number;
inputDir?: string;
jpegQuality?: number;
keywords?: string;
notes?: boolean;
ogImage?: string;
output?: string | false;
parallel?: number | boolean;
pdf?: boolean;
pdfNotes?: boolean;
pdfOutlines?: boolean;
'pdfOutlines.pages'?: boolean;
'pdfOutlines.headings'?: boolean;
pptx?: boolean;
pptxEditable?: boolean;
preview?: boolean;
server?: boolean;
template?: string;
theme?: string;
themeSet?: string[];
title?: string;
url?: string;
watch?: boolean;
}
export type IMarpCLIConfig = Overwrite<Omit<IMarpCLIArguments, '_' | 'configFile' | 'bespoke.osc' | 'bespoke.progress' | 'bespoke.transition' | 'pdfOutlines' | 'pdfOutlines.pages' | 'pdfOutlines.headings'>, {
bespoke?: {
osc?: boolean;
progress?: boolean;
transition?: boolean;
};
browser?: 'auto' | FinderName | FinderName[];
browserProtocol?: 'cdp' | 'webdriver-bidi';
engine?: ResolvableEngine;
html?: ConverterOption['html'];
keywords?: string | string[];
lang?: string;
options?: ConverterOption['options'];
pdfOutlines?: boolean | {
pages?: boolean;
headings?: boolean;
};
themeSet?: string | string[];
}>;
export declare const DEFAULT_PARALLEL = 5;
export declare class MarpCLIConfig {
args: IMarpCLIArguments;
conf: IMarpCLIConfig;
confPath?: string;
engine: ResolvedEngine;
static moduleName: "marp";
static fromArguments(args: IMarpCLIArguments): Promise<MarpCLIConfig>;
static isESMAvailable(): boolean;
private constructor();
browserManagerOption(): {
readonly finders: "chrome" | "firefox" | "edge" | ("chrome" | "firefox" | "edge")[] | undefined;
readonly path: string | undefined;
readonly protocol: "cdp" | "webDriverBiDi";
readonly timeout: number | undefined;
};
converterOption(): Promise<{
readonly imageScale: number | undefined;
readonly inputDir: string | undefined;
readonly output: string | false | undefined;
readonly parallel: number;
readonly pdfNotes: boolean;
readonly pdfOutlines: false | {
pages: boolean;
headings: boolean;
};
readonly pptxEditable: boolean;
readonly preview: boolean;
readonly server: boolean;
readonly template: string;
readonly templateOption: TemplateOption;
readonly themeSet: ThemeSet;
readonly type: ConvertType;
readonly allowLocalFiles: boolean;
readonly baseUrl: string | undefined;
readonly engine: import("./engine").Engine<typeof Marpit.Marpit>;
readonly globalDirectives: {
readonly author: string | undefined;
readonly description: string | undefined;
readonly image: string | undefined;
readonly keywords: string[] | undefined;
readonly theme: string | undefined;
readonly title: string | undefined;
readonly url: string | undefined;
};
readonly html: boolean | import("@marp-team/marp-core/types/src/html/allowlist").HTMLAllowList | undefined;
readonly jpegQuality: number;
readonly lang: string;
readonly options: Marpit.Options;
readonly pages: boolean;
readonly watch: boolean;
}>;
get files(): string[];
private inputDir;
private loadConf;
private loadTheme;
}
export declare const fromArguments: typeof MarpCLIConfig.fromArguments;
export {};

View File

@@ -0,0 +1,100 @@
import type { MarpOptions } from '@marp-team/marp-core';
import { Options as MarpitOptions } from '@marp-team/marpit';
import type { Browser } from './browser/browser';
import type { BrowserManager } from './browser/manager';
import { Engine } from './engine';
import { File } from './file';
import { SOffice } from './soffice/soffice';
import { Template, TemplateMeta, TemplateOption, TemplateResult } from './templates/';
import { ThemeSet } from './theme';
import { type WatchNotifierEntrypointType } from './watcher';
export declare enum ConvertType {
html = "html",
pdf = "pdf",
png = "png",
pptx = "pptx",
jpeg = "jpg",
notes = "notes"
}
export declare const mimeTypes: {
html: string;
pdf: string;
png: string;
pptx: string;
jpg: string;
notes: string;
};
export interface ConverterOption {
allowLocalFiles: boolean;
baseUrl?: string;
browserManager: BrowserManager;
engine: Engine;
globalDirectives: {
theme?: string;
} & Partial<TemplateMeta>;
html?: MarpOptions['html'];
imageScale?: number;
inputDir?: string;
lang: string;
options: MarpitOptions;
output?: string | false;
pages?: boolean | number[];
parallel?: number;
pdfNotes?: boolean;
pdfOutlines?: false | {
pages: boolean;
headings: boolean;
};
pptxEditable?: boolean;
preview?: boolean;
jpegQuality?: number;
server?: boolean;
template: string;
templateOption?: TemplateOption;
themeSet: ThemeSet;
type: ConvertType;
watch: boolean | WatchNotifierEntrypointType;
}
export interface ConvertFileOption {
onConverted?: ConvertedCallback;
onlyScanning?: boolean;
}
export interface ConvertPDFOption {
postprocess?: boolean;
}
export interface ConvertImageOption {
pages?: boolean | number[];
quality?: number;
scale?: number;
type: ConvertType.png | ConvertType.jpeg;
}
export interface ConvertResult {
file: File;
newFile?: File;
template: TemplateResult;
}
export type ConvertedCallback = (result: ConvertResult) => void;
export declare class Converter {
readonly options: ConverterOption;
private _sOffice;
private _firefoxPDFConversionWarning;
private _experimentalEditablePPTXWarning;
constructor(opts: ConverterOption);
get browser(): Promise<Browser>;
get template(): Template;
get sOffice(): SOffice;
convert(markdown: string, file?: File, { fallbackToPrintableTemplate, }?: {
fallbackToPrintableTemplate?: boolean;
}): Promise<TemplateResult>;
convertFile(file: File, opts?: ConvertFileOption): Promise<ConvertResult>;
convertFiles(files: File[], opts?: ConvertFileOption): Promise<void>;
private convertFileToHTML;
private convertFileToNotes;
private convertFileToPDF;
private convertFileToImage;
private convertFileToPPTX;
private convertFileToEditablePPTX;
private generateEngine;
private usePuppeteer;
private trackFailedLocalFileAccess;
}

24
node_modules/@marp-team/marp-cli/types/src/engine.d.ts generated vendored Normal file
View File

@@ -0,0 +1,24 @@
import type { Marp } from '@marp-team/marp-core';
import { Marpit } from '@marp-team/marpit';
type FunctionalEngine<T extends typeof Marpit = typeof Marpit> = (constructorOptions: ConstructorParameters<T>[0] & {
readonly marp: Marp;
}) => Marpit | typeof Marpit | Promise<Marpit | typeof Marpit>;
export type Engine<T extends typeof Marpit = typeof Marpit> = Marpit | typeof Marpit | FunctionalEngine<T>;
export type ResolvableEngine<T extends typeof Marpit = typeof Marpit> = Engine<T> | string;
export declare class ResolvedEngine<T extends Engine = Engine> {
klass: T;
private _cachedPackage?;
private static _defaultEngine;
static resolve<T extends Engine = Engine>(engine: ResolvableEngine | ResolvableEngine[], from?: string): Promise<ResolvedEngine<T>>;
static resolveDefaultEngine(): Promise<ResolvedEngine<typeof Marp>>;
getPackage(): Promise<Record<string, any> | null>;
private static resolveModule;
private constructor();
private resolvePackage;
static isESMAvailable(): boolean;
private static _silentImportOrRequire;
private static _silentImport;
private static _silentRequire;
private findClassPath;
}
export {};

View File

@@ -0,0 +1 @@
export declare const generateOverrideGlobalDirectivesPlugin: (directives: Record<string, any>) => (md: any) => void;

View File

@@ -0,0 +1,17 @@
export interface EngineInfo {
author: string | undefined;
description: string | undefined;
image: string | undefined;
keywords: string[] | undefined;
lang: string | undefined;
length: number;
size: {
height: number;
width: number;
};
theme: string | undefined;
title: string | undefined;
url: string | undefined;
}
export declare const engineInfo: unique symbol;
export default function infoPlugin(md: any): void;

View File

@@ -0,0 +1,9 @@
import { Marpit } from '@marp-team/marpit';
import type MarkdownIt from 'markdown-it';
type Token = ReturnType<MarkdownIt['parse']>[number];
export declare const keywordsAsArray: (keywords: unknown) => string[] | undefined;
export declare const detectTitle: (tokens: Token[]) => string | undefined;
export default function metaPlugin(md: MarkdownIt & {
marpit: Marpit;
}): void;
export {};

View File

@@ -0,0 +1,36 @@
import type { Marpit } from '@marp-team/marpit';
import type MarkdownIt from 'markdown-it';
import type { PDFOutline } from '../../utils/pdf';
export interface OutlinePage {
pageNumber: number;
headings: OutlineHeading[];
}
export interface OutlineHeading {
level: number;
key: string;
}
export type OutlineData = Record<string, [
x: number,
y: number,
text: string
] | undefined>;
export declare const pdfOutlineAttr: "data-marp-cli-pdf-outline";
export declare const pdfOutlineInfo: unique symbol;
export declare function pdfOutlinePlugin(md: MarkdownIt & {
marpit: Marpit;
}): void;
export declare const pptrOutlinePositionResolver: (headings: OutlineHeading[], attr: typeof pdfOutlineAttr) => OutlineData;
type GeneratePDFOutlinesOptions = {
pages: boolean;
data?: OutlineData;
} & ({
headings: false;
} | {
headings: true;
size: {
width: number;
height: number;
};
});
export declare const generatePDFOutlines: (pages: OutlinePage[], opts: GeneratePDFOutlinesOptions) => PDFOutline[];
export {};

View File

@@ -0,0 +1,9 @@
import { Marpit } from '@marp-team/marpit';
import type MarkdownIt from 'markdown-it';
export declare const engineTransition: unique symbol;
export interface EngineTransition {
builtinTransitionStyle: string;
}
export default function transitionPlugin(md: MarkdownIt & {
marpit: Marpit;
}): void;

19
node_modules/@marp-team/marp-cli/types/src/error.d.ts generated vendored Normal file
View File

@@ -0,0 +1,19 @@
export declare class CLIError extends Error {
readonly errorCode: number;
readonly message: string;
readonly name = "CLIError";
constructor(message: string, errorCode?: number);
toString(): string;
}
export declare const CLIErrorCode: {
readonly INVALID_OPTIONS: -1;
readonly GENERAL_ERROR: 1;
readonly NOT_FOUND_BROWSER: 2;
readonly LISTEN_PORT_IS_ALREADY_USED: 3;
readonly CANNOT_SPAWN_SNAP_CHROMIUM: 4;
readonly NOT_FOUND_SOFFICE: 5;
/** @deprecated NOT_FOUND_CHROMIUM is renamed to NOT_FOUND_BROWSER. */
readonly NOT_FOUND_CHROMIUM: 2;
};
export declare function error(msg: string, errorCode?: number): never;
export declare const isError: (e: unknown) => e is NodeJS.ErrnoException;

44
node_modules/@marp-team/marp-cli/types/src/file.d.ts generated vendored Normal file
View File

@@ -0,0 +1,44 @@
import { Options as GlobbyOptions } from 'globby';
export declare const markdownExtensions: string[];
interface GenerateTmpFileInterfaceOptions {
extension?: `.${string}`;
}
export declare const generateTmpFileInterface: ({ extension, }?: GenerateTmpFileInterfaceOptions) => Promise<File.TmpFileInterface>;
export interface FileConvertOption {
extension?: string;
page?: number;
}
export declare enum FileType {
File = 0,
StandardIO = 1,
Null = 2
}
export declare class File {
buffer?: Buffer;
inputDir?: string;
type: FileType;
readonly path: string;
constructor(filepath: string);
get absolutePath(): string;
get absoluteFileScheme(): string;
convert(output: string | false | undefined, opts: FileConvertOption): File;
load(): Promise<Buffer<ArrayBufferLike>>;
relativePath(from?: string): string;
save(): Promise<void>;
saveTmpFile({ extension, }?: GenerateTmpFileInterfaceOptions): Promise<File.TmpFileInterface>;
private convertName;
private saveToFile;
private static stdinBuffer?;
static findPath(opts: GlobbyOptions, ...paths: string[]): Promise<string[]>;
static find(...paths: string[]): Promise<File[]>;
static findDir(directory: string): Promise<File[]>;
static stdin(): Promise<File | undefined>;
private static initialize;
}
export declare namespace File {
interface TmpFileInterface extends AsyncDisposable, Disposable {
path: string;
cleanup: () => Promise<void>;
}
}
export {};

23
node_modules/@marp-team/marp-cli/types/src/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,23 @@
import type { Marp } from '@marp-team/marp-core';
import type { Marpit } from '@marp-team/marpit';
import type { IMarpCLIConfig } from './config';
import type { ResolvableEngine } from './engine';
import { apiInterface } from './marp-cli';
type Overwrite<T, U> = Omit<T, Extract<keyof T, keyof U>> & U;
export { ObservationHelper, waitForObservation } from './marp-cli';
export { CLIError, CLIErrorCode } from './error';
export declare const marpCli: (argv: string[], opts?: import("./marp-cli").MarpCLIAPIOptions) => Promise<number>;
export default apiInterface;
export interface Config<Engine extends typeof Marpit = typeof Marp> extends Overwrite<Omit<IMarpCLIConfig,
/**
* This option is internal setting for collaboration with Marp team tools such as Marp for VS Code.
* It is not designed for users because the result of conversion may break if set wrong base URL.
*/
'baseUrl'>, {
engine?: ResolvableEngine<Engine>;
image?: 'png' | 'jpeg';
images?: 'png' | 'jpeg';
options?: ConstructorParameters<Engine>[0];
}> {
}
export declare const defineConfig: <Engine extends typeof Marpit = typeof Marp>(config: Config<Engine>) => Config<Engine>;

View File

@@ -0,0 +1,16 @@
export interface MarpCLIOptions {
baseUrl?: string;
stdin: boolean;
throwErrorAlways: boolean;
}
export type MarpCLIAPIOptions = Pick<MarpCLIOptions, 'baseUrl'>;
export interface MarpCLICLIOptions {
debug?: string | boolean;
}
export interface ObservationHelper {
stop: () => void;
}
export declare const marpCli: (argv: string[], { baseUrl, stdin: defaultStdin, throwErrorAlways }: MarpCLIOptions) => Promise<number>;
export declare const waitForObservation: () => Promise<ObservationHelper>;
export declare const apiInterface: (argv: string[], opts?: MarpCLIAPIOptions) => Promise<number>;
export declare const cliInterface: (argv: string[]) => Promise<number>;

View File

@@ -0,0 +1,3 @@
export declare const patch: () => void;
export declare const enableCompileCache: () => void;
export declare const patchSegmenter: () => void;

View File

@@ -0,0 +1,5 @@
export declare const defaultDebug = "marp-cli*";
export declare const cliPrepare: (args?: string[]) => {
args: string[];
debug: string | false;
};

View File

@@ -0,0 +1,43 @@
import { EventEmitter } from 'node:events';
import type { Page, Browser } from 'puppeteer-core';
import TypedEmitter from 'typed-emitter';
import { BrowserManager } from './browser/manager';
import { ConvertType } from './converter';
import { File } from './file';
export declare namespace Preview {
type PartialByKeys<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>> & Partial<Pick<T, K>>;
export type Events = {
close: (window: any) => void;
exit: () => void;
launch: () => void;
open: (window: any, location: string) => void;
opening: (location: string) => void;
};
export interface Options {
browserManager: BrowserManager;
height: number;
width: number;
}
export type ConstructorOptions = PartialByKeys<Options, 'height' | 'width'>;
export interface Window extends EventEmitter {
page: Page;
close: () => Promise<void>;
load: (uri: string) => Promise<void>;
}
export {};
}
declare const Preview_base: new () => TypedEmitter<Preview.Events>;
export declare class Preview extends Preview_base {
readonly options: Preview.Options;
private puppeteerInternal;
constructor(opts: Preview.ConstructorOptions);
get puppeteer(): Browser | undefined;
open(location: string): Promise<Preview.Window>;
exit(): Promise<void>;
private get browserManager();
private createWindowObject;
private createWindow;
private launch;
}
export declare function fileToURI(file: File, type: ConvertType): string;
export {};

40
node_modules/@marp-team/marp-cli/types/src/server.d.ts generated vendored Normal file
View File

@@ -0,0 +1,40 @@
import fs from 'node:fs';
import { Server as HttpServer } from 'node:http';
import type { Express } from 'express';
import TypedEmitter from 'typed-emitter';
import { Converter, ConvertedCallback } from './converter';
declare const Server_base: new () => TypedEmitter<Server.Events>;
export declare class Server extends Server_base {
readonly converter: Converter;
readonly inputDir: string;
readonly options: Server.Options;
readonly port: number;
directoryIndex: string[];
httpServer: HttpServer | undefined;
server: Express | undefined;
private static script;
constructor(converter: Converter, opts?: Server.Options);
start(): Promise<void>;
stop(): Promise<void>;
private convertMarkdown;
private loadScript;
private preprocess;
private setup;
private template;
private validateMarkdown;
}
export declare namespace Server {
type Events = {
converted: ConvertedCallback;
error: (err: Error) => void;
};
interface Options {
directoryIndex?: string[];
}
interface ValidateResult {
path: string;
stats?: fs.Stats;
valid: boolean;
}
}
export {};

View File

@@ -0,0 +1,2 @@
export declare const showAllKey = "marp-cli-show-all";
export default function serverIndex(): void;

View File

@@ -0,0 +1,5 @@
export declare const findSOffice: ({ preferredPath, }?: {
preferredPath?: string;
}) => Promise<{
readonly path: string;
}>;

View File

@@ -0,0 +1,19 @@
export interface SOfficeOptions {
path?: string;
}
export interface SOfficeProfileDir {
path: string;
fileURL: string;
}
export declare class SOffice {
#private;
preferredPath?: string;
private _path;
private _profileDir;
private static _spawnQueue;
constructor(opts?: SOfficeOptions);
get path(): Promise<string>;
get profileDir(): Promise<SOfficeProfileDir>;
spawn(args: string[]): Promise<void>;
private setProfileDir;
}

View File

@@ -0,0 +1,2 @@
declare const bespokeTemplate: (target?: HTMLElement) => any;
export default bespokeTemplate;

View File

@@ -0,0 +1,2 @@
declare const bespokeClasses: (deck: any) => void;
export default bespokeClasses;

View File

@@ -0,0 +1,8 @@
export interface FragmentEvent {
slide: any[];
index: number;
fragments: any[];
fragmentIndex: number;
}
declare const bespokeFragments: (deck: any) => void;
export default bespokeFragments;

View File

@@ -0,0 +1,2 @@
declare const bespokeFullscreen: (deck: any) => void;
export default bespokeFullscreen;

View File

@@ -0,0 +1,2 @@
declare const bespokeInactive: (timeout?: number) => ({ parent, fire: _fire }: any) => void;
export default bespokeInactive;

View File

@@ -0,0 +1,2 @@
declare const bespokeInteractive: (deck: any) => void;
export default bespokeInteractive;

View File

@@ -0,0 +1,2 @@
declare const bespokeLoad: (deck: any) => void;
export default bespokeLoad;

View File

@@ -0,0 +1,5 @@
export interface BespokeNavigationOption {
interval?: number;
}
declare const bespokeNavigation: ({ interval }?: BespokeNavigationOption) => (deck: any) => void;
export default bespokeNavigation;

View File

@@ -0,0 +1,2 @@
declare const bespokeOSC: (selector?: string) => (deck: any) => void;
export default bespokeOSC;

View File

@@ -0,0 +1,2 @@
declare const bespokePresenter: (target: HTMLElement) => ((deck: any) => void) | ((deck: any) => void) | ((deck: any) => void);
export default bespokePresenter;

View File

@@ -0,0 +1,2 @@
declare const nextView: (deck: any) => void;
export default nextView;

View File

@@ -0,0 +1,2 @@
declare const normalView: (deck: any) => void;
export default normalView;

View File

@@ -0,0 +1,24 @@
export declare const presenterPrefix: "bespoke-marp-presenter-";
export declare const classes: {
readonly container: "bespoke-marp-presenter-container";
readonly dragbar: "bespoke-marp-presenter-dragbar-container";
readonly next: "bespoke-marp-presenter-next";
readonly nextContainer: "bespoke-marp-presenter-next-container";
readonly noteContainer: "bespoke-marp-presenter-note-container";
readonly noteWrapper: "bespoke-marp-presenter-note-wrapper";
readonly noteButtons: "bespoke-marp-presenter-note-buttons";
readonly infoContainer: "bespoke-marp-presenter-info-container";
readonly infoPage: "bespoke-marp-presenter-info-page";
readonly infoPageText: "bespoke-marp-presenter-info-page-text";
readonly infoPagePrev: "bespoke-marp-presenter-info-page-prev";
readonly infoPageNext: "bespoke-marp-presenter-info-page-next";
readonly noteButtonsBigger: "bespoke-marp-presenter-note-bigger";
readonly noteButtonsSmaller: "bespoke-marp-presenter-note-smaller";
readonly infoTime: "bespoke-marp-presenter-info-time";
readonly infoTimer: "bespoke-marp-presenter-info-timer";
};
export declare const properties: {
readonly noteFontScale: "--bespoke-marp-note-font-scale";
};
declare const presenterView: (deck: any) => void;
export default presenterView;

View File

@@ -0,0 +1,2 @@
declare const basepokeProgress: (deck: any) => void;
export default basepokeProgress;

View File

@@ -0,0 +1,5 @@
export interface BespokeStateOption {
history?: boolean;
}
declare const bespokeState: (opts?: BespokeStateOption) => (deck: any) => void;
export default bespokeState;

View File

@@ -0,0 +1,10 @@
export interface BespokeSyncOption {
key?: string;
}
export interface BespokeSyncState {
reference: number;
index: number;
fragmentIndex: number;
}
declare const bespokeSync: (opts?: BespokeSyncOption) => (deck: any) => void;
export default bespokeSync;

View File

@@ -0,0 +1,12 @@
export interface BespokeTouchOption {
slope?: number;
swipeThreshold?: number;
}
export interface TouchPoint {
x: number;
y: number;
radian?: number;
delta?: number;
}
declare const bespokeTouch: ({ slope, swipeThreshold, }?: BespokeTouchOption) => (deck: any) => void;
export default bespokeTouch;

View File

@@ -0,0 +1,3 @@
export declare const transitionStyleId: "_tSId";
declare const bespokeTransition: (deck: any) => void;
export default bespokeTransition;

View File

@@ -0,0 +1,26 @@
type LocationLike = Pick<Location, 'protocol' | 'host' | 'pathname' | 'hash' | 'search'>;
type QuerySetter = (...args: Parameters<History['pushState']>) => void;
export declare const ViewModeNormal = "";
export declare const ViewModePresenter = "presenter";
export declare const ViewModeNext = "next";
export declare const viewModes: readonly ["", "presenter", "next"];
export declare const classPrefix = "bespoke-marp-";
export declare const dataAttrPrefix: "data-bespoke-marp-";
export declare const generateURLfromParams: (params: URLSearchParams, { protocol, host, pathname, hash }?: LocationLike) => string;
export declare const getViewMode: () => (typeof viewModes)[number];
export declare const readQuery: (name: string) => string | null;
export declare const popQuery: (name: string) => string | null;
export declare const setQuery: (queries: Record<string, string | false | null | undefined>, opts?: {
location?: LocationLike;
setter?: QuerySetter;
}) => void;
export declare const setHistoryState: (state: Record<string, any>) => void;
export declare const setViewMode: () => void;
export declare const storage: {
available: boolean;
get: (key: string) => string | null;
set: (key: string, value: string) => boolean;
remove: (key: string) => boolean;
};
export declare const toggleAriaHidden: (element: HTMLElement, value: boolean) => void;
export {};

View File

@@ -0,0 +1,6 @@
export declare const isEnabled: () => boolean;
export declare const isFullscreen: () => boolean;
export declare const enter: (target?: HTMLElement) => void | Promise<void>;
export declare const exit: () => void | Promise<void>;
export declare const toggle: () => Promise<void>;
export declare const onChange: (callback: () => void) => void;

View File

@@ -0,0 +1,36 @@
export interface ResolveAnimationOptions {
type: 'incoming' | 'outgoing';
backward?: boolean;
duration?: string;
}
export interface MarpTransitionData {
name: string;
duration?: string;
builtinFallback?: boolean;
}
export interface MarpTransitionKeyframeSettings {
name: string;
defaultDuration?: string;
}
export type MarpTransitionResolvableKeyframeSettings = Omit<MarpTransitionKeyframeSettings, 'name'>;
export type MarpTransitionKeyframes = Record<keyof typeof directions, Record<keyof typeof types, MarpTransitionKeyframeSettings | undefined>>;
export declare const _resetResolvedKeyframes: () => void;
export declare const _testElementAnimation: (elm: HTMLElement, callback: (ret: MarpTransitionResolvableKeyframeSettings | undefined) => void) => void;
declare const types: {
readonly both: "";
readonly outgoing: "outgoing-";
readonly incoming: "incoming-";
};
declare const directions: {
readonly forward: "";
readonly backward: "-backward";
};
export declare const getMarpTransitionKeyframes: (transitionName: string, { builtinFallback }?: {
builtinFallback?: boolean;
}) => Promise<Readonly<MarpTransitionKeyframes> | undefined>;
export declare const isMarpTransitionKeyframesEmpty: (keyframes: MarpTransitionKeyframes) => boolean;
export declare const prepareMarpTransitions: (...transitionNames: string[]) => Promise<void>;
export declare const resolveAnimationStyles: (keyframes: MarpTransitionKeyframes, opts: Omit<ResolveAnimationOptions, "type">) => readonly string[];
export declare const isTransitionData: (data: unknown) => data is MarpTransitionData;
export declare const parseTransitionData: (rawJSON: string | undefined) => MarpTransitionData | undefined;
export {};

View File

@@ -0,0 +1,6 @@
type WakeLockObject = EventTarget | null;
export declare const wakeLockApi: any;
export declare const requestWakeLock: () => Promise<WakeLockObject>;
export declare const _clearCachedWakeLockApi: () => void;
declare const bespokeWakeLock: () => Promise<WakeLockObject | undefined>;
export default bespokeWakeLock;

View File

@@ -0,0 +1,52 @@
import { Marpit, Options, RenderResult } from '@marp-team/marpit';
import { OutlinePage } from '../engine/pdf/outline-plugin';
import { EngineTransition } from '../engine/transition-plugin';
type RendererResult = RenderResult & TemplateMeta & {
length: number;
size: RenderedSize;
transition?: EngineTransition;
outline?: OutlinePage[];
};
interface TemplateRendererOptions extends Options {
modifier?: (marpit: Marpit) => void;
}
interface TemplateCoreOption {
base?: string;
notifyWS?: string;
renderer: (tplOpts: TemplateRendererOptions) => RendererResult | Promise<RendererResult>;
}
export interface TemplateMeta {
author: string | undefined;
description: string | undefined;
image: string | undefined;
keywords: string[] | undefined;
title: string | undefined;
url: string | undefined;
lang: string | undefined;
}
interface RenderedSize {
height: number;
width: number;
}
export type TemplateOption = TemplateBareOption | TemplateBespokeOption;
interface TemplateBareOption {
}
interface TemplateBespokeOption {
osc?: boolean;
progress?: boolean;
transition?: boolean;
}
export interface TemplateResult {
rendered: RendererResult;
result: string;
}
export type Template<T = TemplateOption> = ((locals: TemplateCoreOption & T) => Promise<TemplateResult>) & {
printable?: boolean;
};
export declare const bare: Template<TemplateBareOption>;
export declare const bespoke: Template<TemplateBespokeOption>;
declare const _default: {
bare: Template<TemplateBareOption>;
bespoke: Template<TemplateBespokeOption>;
};
export default _default;

View File

@@ -0,0 +1,2 @@
declare const watch: () => WebSocket | undefined;
export default watch;

36
node_modules/@marp-team/marp-cli/types/src/theme.d.ts generated vendored Normal file
View File

@@ -0,0 +1,36 @@
import { Marpit } from '@marp-team/marpit';
export declare class Theme {
readonly filename: string;
readonly overrideName?: string;
name?: string;
private readBuffer?;
private constructor();
get buffer(): Buffer<ArrayBufferLike>;
get css(): string;
load(): Promise<void>;
private genUniqName;
static initialize(filename: string, opts?: Theme.Options): Promise<Theme>;
}
export declare class ThemeSet {
readonly fn: string[];
readonly fnForWatch: string[];
/** The key-value pair from file path to instance */
readonly themes: Map<string, Theme>;
onThemeUpdated: (path: string) => void;
private observedMarkdowns;
private constructor();
findPath(): Promise<string[]>;
load(fn: string): Promise<void>;
observe(markdownPath: string, theme: string | undefined): void;
registerTo(engine: Marpit): void;
unobserve(markdownPath: string): void;
private add;
private notify;
static initialize(baseFn: string[], themes?: Theme[]): Promise<ThemeSet>;
private static findPath;
}
export declare namespace Theme {
interface Options {
overrideName?: true | string;
}
}

View File

@@ -0,0 +1 @@
export declare const isStandaloneBinary: () => boolean;

View File

@@ -0,0 +1,2 @@
export declare const isInsideContainer: () => boolean;
export declare const isOfficialContainerImage: () => boolean;

View File

@@ -0,0 +1,9 @@
import dbg from 'debug';
export declare const debug: dbg.Debugger;
export declare const debugConfig: dbg.Debugger;
export declare const debugBrowser: dbg.Debugger;
export declare const debugBrowserFinder: dbg.Debugger;
export declare const debugEngine: dbg.Debugger;
export declare const debugPreview: dbg.Debugger;
export declare const debugWatcher: dbg.Debugger;
export declare const debugWatcherWS: dbg.Debugger;

View File

@@ -0,0 +1,9 @@
export declare const getPlatform: () => Promise<"wsl1" | NodeJS.Platform>;
export declare const isAccessible: (path: string, mode?: number) => Promise<boolean>;
export declare const isExecutable: (path: string) => Promise<boolean>;
export declare const isReadable: (path: string) => Promise<boolean>;
export declare const findExecutable: (paths: string[]) => Promise<string | undefined>;
export declare const isSnapBrowser: (executablePath: string) => Promise<boolean>;
export declare const findExecutableBinary: (binaries: string[]) => Promise<string | undefined>;
export declare const which: (command: string) => Promise<string | undefined>;
export declare const normalizeDarwinAppPath: (executablePath: string) => Promise<string>;

View File

@@ -0,0 +1,2 @@
import { Browser } from '../browser/browser';
export declare const png2jpegViaPuppeteer: (browser: Browser, pngBuffer: Uint8Array, quality?: number) => Promise<Buffer<ArrayBuffer>>;

View File

@@ -0,0 +1,7 @@
type MemoizedPromiseAllowedValue = NonNullable<unknown> | null;
export interface MemoizedPromiseContext<T extends MemoizedPromiseAllowedValue> {
value: Promise<T> | T | undefined;
init: (initializer: () => T | Promise<T>) => Promise<T>;
}
export declare const createMemoizedPromiseContext: <T extends MemoizedPromiseAllowedValue>() => MemoizedPromiseContext<T>;
export {};

View File

@@ -0,0 +1,16 @@
import type { PDFDocument } from 'pdf-lib';
type PDFOutlineTo = number | [pageIndex: number, xPercentage: number, yPercentage: number];
export interface PDFOutlineItem {
title: string;
to: PDFOutlineTo;
italic?: boolean;
bold?: boolean;
}
export interface PDFOutlineItemWithChildren extends Omit<PDFOutlineItem, 'to'> {
to?: PDFOutlineTo;
children: PDFOutline[];
open: boolean;
}
export type PDFOutline = PDFOutlineItem | PDFOutlineItemWithChildren;
export declare const setOutline: (doc: PDFDocument, outlines: readonly PDFOutline[]) => Promise<void>;
export {};

View File

@@ -0,0 +1 @@
export declare const getStdin: () => Promise<Buffer>;

View File

@@ -0,0 +1 @@
export declare const generateTmpName: (extension?: `.${string}`) => Promise<string>;

View File

@@ -0,0 +1,7 @@
export declare const translateWSLPathToWindows: (wslPath: string, useSlash?: boolean) => Promise<string>;
export declare const translateWindowsPathToWSL: (winPath: string) => Promise<string>;
export declare const getWindowsEnv: (envName: string) => Promise<string | undefined>;
type WSL2NetworkingMode = 'nat' | 'mirrored';
export declare const getWSL2NetworkingMode: () => Promise<WSL2NetworkingMode | null>;
export declare const isWSL: () => Promise<number>;
export {};

View File

@@ -0,0 +1,4 @@
import type { Argv } from 'yargs';
import yargs from 'yargs/yargs';
export declare const createYargs: (...opts: Parameters<typeof yargs>) => Argv<{}>;
export declare const terminalWidth: () => number;

View File

@@ -0,0 +1,4 @@
import { MarpCLIConfig } from './config';
import { ResolvedEngine } from './engine';
export declare const isMarpCore: (engine: ResolvedEngine) => Promise<boolean>;
export default function outputVersion(config: MarpCLIConfig): Promise<0>;

View File

@@ -0,0 +1,51 @@
import { type FSWatcher } from 'chokidar';
import { WebSocketServer } from 'ws';
import type { ServerOptions } from 'ws';
import { Converter, ConvertedCallback } from './converter';
import { File } from './file';
export declare class Watcher {
chokidar: FSWatcher;
readonly converter: Converter;
readonly events: Watcher.Events;
readonly finder: Watcher.Options['finder'];
readonly mode: Watcher.WatchMode;
private constructor();
private log;
private convert;
private delete;
static watch(watchPath: string[], opts: Watcher.Options): Watcher;
}
export type WatchNotifierEntrypointType = 'static' | 'server';
export declare class WatchNotifier {
listeners: Map<string, Set<any>>;
private wss?;
private portNumber?;
static readonly webSocketEntrypoint = ".__marp-cli-watch-notifier__";
get server(): WebSocketServer | undefined;
port(): Promise<number>;
register(fn: string, entrypointType?: WatchNotifierEntrypointType): Promise<string>;
entrypoint(identifier: string, entrypointType?: WatchNotifierEntrypointType): Promise<string>;
sendTo(fn: string, command: string): boolean;
start(opts?: ServerOptions): Promise<void>;
stop(): Promise<boolean>;
static sha256(fn: string): string;
}
export declare const notifier: WatchNotifier;
declare const _default: typeof Watcher.watch;
export default _default;
export declare namespace Watcher {
enum WatchMode {
Convert = 0,
Notify = 1
}
interface Options {
converter: Converter;
events: Watcher.Events;
finder: () => Promise<File[]>;
mode: WatchMode;
}
interface Events {
onConverted: ConvertedCallback;
onError: (e: Error) => void;
}
}