marp-team / marp-cli Goto Github PK
View Code? Open in Web Editor NEWA CLI interface for Marp and Marpit based converters
License: MIT License
A CLI interface for Marp and Marpit based converters
License: MIT License
I've found some cases that Marp CLI hangs up while getting contents from stdin by using get-stdin
module.
node -e "require('child_process').exec('./marp')"
It may be related to sindresorhus/get-stdin#13.
https://github.com/marp-team/marp-cli#zero-js-slide-deck and https://github.com/marp-team/marp-cli#use-marpit-framework use the engine option --engine @marp-team/marpit
, but this option makes the background color black (font color is also black, so texts cannot be seen.)
I confirm --engine @marp-team/marp-core
works well. So I think we should fix the doc.
It would be nice if marp-cli
would print a warning when the system detects the older dollar prefixes.
Related: #165
Hello, for some weird reason, my code block is no longer working in my browser. It was working a few weeks ago. Would you be able to give me some pointer?
---
marp: true
theme: default
---
# Normal
Welcome
---
# Code Block
` ` `js
// apologies for the triple backticks written as so, it's so that it can be previewed properly
console.log('hello');
` ` `
npx @marp-team/marp-cli -s ./docs
uncover
and it works, however I can't use that theme because i need a sizeable realestate for my actual code block--html
and add<script defer src="https://cdn.jsdelivr.net/npm/@marp-team/marp-core/lib/browser.js"></script>
into the code block but it doesn't help
Thank you 🙏
Marp is a nice software for presentation
Now I wondering if there is any way to add a column feature to Marp?
It would be good to fill the title for converted HTML automatically from the heading of title slide when --title
option (and title
global directive) is not passed.
We make this plan from TODO comment in Marp CLI meta plugin.
marp-cli/src/engine/meta-plugin.ts
Line 23 in 5f6635a
The other similar tool also has a plan for auto-filling of the title: jxnblk/mdx-deck#103 (v3)
I use this command to convert a set of markdown files to html files:
marp --input-dir=./slides --output=./dist
However, local assets such as images and videos do not copy to dist
directory. Is there possibility that marp
could autodect referenced local assets and copy to dist
directory?Just like what webpack
do? Otherwise, I should manually copy that assets to dist.
I did a little work to narrow this down, but sometime after this commit 3fe441cf7a406416300735b0f5de4a6e48a6ff69
the PDF rendering started hanging (at least in the docker container). Building the Docker container from this commit, still works.
On HEAD, adding --pdf
to the command line causes the container to just hang while rendering.
docker run --rm -v $PWD:/home/marp/app/ marpteam/marp-cli:latest target.md --theme-set spkane.css --pdf --allow-local-files
[ INFO ] Converting 1 markdown...
[ WARN ] Insecure local file accessing is enabled for conversion of target.pdf.
Building from an commit about a month or two older results in a working PDF render:
docker run --rm -v $PWD:/home/marp/app/ 46c6ff46a3d9 target.md --theme-set spkane.css --pdf --allow-local-files
[ INFO ] Converting 1 markdown...
[ WARN ] Insecure local file accessing is enabled for conversion of target.pdf.
[ INFO ] target.md => target.pdf
When marp-cli was executed in watch mode, an error was output and stopped.
I use macOS Mojave (10.14.6)
% npx @marp-team/marp-cli -w slides.md
[ INFO ] Converting 1 markdown...
[ ERROR ] Failed converting Markdown. (Provided options.stopPort(40000is less than options.startPort (52000))
By using officegen, we might convert from Marpit / Marp Markdown into PowerPoint slide that consists of pre-rendered images.
It's very useful for mixing a traditional presentation deck and the deck made by Marp. In addition, it could use PowerPoint's presenter tool with Marpit's presenter notes.
Exporting PowerPoint deck was mentioned in the old Marp app by yhatt/marp#23. We'll make it wake up.
I suppose it would have to start working after than implemented #71.
--pptx
option and pptx extension in -o
option (-o foobar.pptx
)
Adobe Acrobat can convert the exported PDF into pptx that includes re-editable contents, and keeps the design to some extent.
Why not insert this in Pandoc? Is the target combine the CLI into Marp later?
Is there an option / config to disable "Fragmented list" ?
Serif Chinese font isn't a good choice in slides, so I tried this, but font didn't change.
---
marp: true
theme: gaia
---
<style>
.slide {
font-family: 'Microsoft YaHei', 'SimHei', sans-serif !important;
}
</style>
<!-- class: lead gaia -->
# 标题
## Title
I didn't try it with html output because html version without <style>
worked well with a sans serif font.
So is there any way to change font without editing theme files?
btw Microsoft YaHei might not be a good default font because it is not a free font. Sarasa Gothic may be a good alternative.
--preview
option does not open Chrome window in macOS Catalina. Carlo seems to be failing a resolution of Chrome.
$ npx @marp-team/marp-cli ~/marp/deck.md --preview
[ INFO ] Converting 1 markdown...
[ INFO ] ../../../marp/deck.md => ../../../marp/deck.html
[ INFO ] [Watch mode] Start watching...
[ INFO ] [Preview] (EXPERIMENTAL) Opening file:///Users/yhatt/marp/deck.html...
^C(node:12987) UnhandledPromiseRejectionWarning: Error: Command failed: /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -dump | grep -i 'google chrome canary\?.app$' | awk '{$1=""; print $0}'
at checkExecSyncError (child_process.js:629:11)
at execSync (child_process.js:666:13)
at darwin (/Users/yhatt/.npm/_npx/12987/lib/node_modules/@marp-team/marp-cli/node_modules/carlo/lib/find_chrome.js:33:7)
at findChrome (/Users/yhatt/.npm/_npx/12987/lib/node_modules/@marp-team/marp-cli/node_modules/carlo/lib/find_chrome.js:222:24)
at Object.launch (/Users/yhatt/.npm/_npx/12987/lib/node_modules/@marp-team/marp-cli/node_modules/carlo/lib/carlo.js:594:42)
at Preview.<anonymous> (/Users/yhatt/.npm/_npx/12987/lib/node_modules/@marp-team/marp-cli/lib/marp-cli.js:1:40980)
at Generator.next (<anonymous>)
at /Users/yhatt/.npm/_npx/12987/lib/node_modules/@marp-team/marp-cli/lib/marp-cli.js:1:2090
at new Promise (<anonymous>)
at __awaiter (/Users/yhatt/.npm/_npx/12987/lib/node_modules/@marp-team/marp-cli/lib/marp-cli.js:1:1864)
(node:12987) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 3)
(node:12987) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
According to GoogleChrome/chrome-launcher#146 (comment), macOS Catalina was changed the output of lsregister
but Carlo's Chrome finder is not following this (Carlo might be inactive: GoogleChromeLabs/carlo#163).
(I posted this in Marp VSCode but was told it belonged here instead)
When I used the Fragmented unordered list and export to PPTX, the "fragmented" / animation part doesn't work--that is, all the items appear at once. The fragmented effect works fine in HTML, but not in PPTX
Markdown example:
Title
* item 1
* item 2
My system
OS: Windows 10 Pro version 1803 (build 17134.885)
VSCode: 1.37.1
Marp extension: 0.9.0
Marp team's primary CI won't change from CircleCI, but I think a new bulit-in CI/CD for GitHub Actions is easier to maintain than Azure Pipelines, that is the current secondary CI for Marp team for running tests and builds in Windows environment.
In fact, GitHub Actions is using Azure Pipelines backend.
CircleCI has started supporting Windows environment too. It provides only to user of performance plan, and not yet provided free plan to OSS projects. We might re-migrate to CircleCI when Windows environment in CircleCI could use in OSS project in future.
I had an error when convert my Markdown to HTML.
$ npx @marp-team/marp-cli KotlinUpdates.md
Cannot find module '/Users/yasuyuki/.npm/_npx/40753/lib/node_modules/@marp-team/marp-cli/node_modules/twemoji/dist/twemoji.npm.js'. Please verify that the package.json has a valid "main" entry
My markdown is here: https://github.com/eyasuyuki/KotlinUpdates
On Linux (Ubuntu 18.04.), I am having some problems with the preview mode. Apparently, the program uses grep
internally, resulting in some unwanted behavior, see CLI output below.
$ marp --server --preview ./MarpTest
[ INFO ] [Server mode] Start server listened at http://localhost:8080/ ...
[ INFO ] [Preview] (EXPERIMENTAL) Opening http://localhost:8080...
grep: /XXX/XXX/.local/share/applications/zotero.desktop: No such file or directory
events.js:183
throw er; // Unhandled 'error' event
^
Error: read ECONNRESET
at _errnoException (util.js:1022:11)
at Pipe.onread (net.js:628:25)
During the installation, npm returns the following warning messages
/usr/local/bin/marp -> /usr/local/lib/node_modules/@marp-team/marp-cli/marp-cli.js
- [email protected] node_modules/@marp-team/marp-cli/node_modules/arrify
- markdown-it-katex node_modules/@marp-team/marp-cli/node_modules/markdown-it-katex
/usr/local/lib
└─┬ @marp-team/[email protected]
├─┬ @marp-team/[email protected]
│ └─┬ [email protected]
│ └── [email protected]
├── @marp-team/[email protected]
├─┬ [email protected]
│ └── [email protected]
└─┬ [email protected]
├─┬ [email protected]
│ └─┬ [email protected]
│ └── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]
npm WARN optional Skipping failed optional dependency /@marp-team/marp-cli/chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: [email protected]
Since pkg
v4.4.0 updated in #99, automated standalone build in CI has invalid binary for Windows with segfault error.
Is there a way to export a PDF with Presenter Notes from VS Code?
This closed PR had a feature like it. Is exporting to PPT (via the CLI) the only way to get speaker notes to display?
For a while, Marp CLI has been unstable in Windows environment (#118). We have to run test permanently on Windows too.
Currently CircleCI's Windows support is in early preview. It's better to use AppVeyor for getting stable environment for test in Windows. We will back if CircleCI would get stable Windows environment.
I am running into an error when converting markdown into images using --image
or --images
flag. This can be reproduced with the following test.md
file:
# Title
content
I am running marp-cli using the official Docker image:
$ docker run --rm -v $PWD:/build -w /build marpteam/marp-cli --image png test.md
[ INFO ] Converting 1 markdown...
[ ERROR ] Failed converting Markdown. (r.emulateMediaType is not a function)
Version:
$ docker run --rm marpteam/marp-cli --version
@marp-team/marp-cli v0.16.2 (w/ @marp-team/marp-core v0.15.2)
At the same time, conversion to PDF works fine.
The issue was not present in marpteam/marp-cli:v0.15.1 Docker image.
marp-cli failed to glob markdown files within non-ASCII directory. Thus marp --server .
exits.
% grep marp-cli yarn.lock
"@marp-team/marp-cli@^0.10.0":
resolved "https://registry.yarnpkg.com/@marp-team/marp-cli/-/marp-cli-0.10.2.tgz#111be76a2df5f3c228f08dc3627eadbe23fbf3e8"
% pwd
/Users/seiya.yazaki/work/github.com/saiya/presentations/190913 RDBMS 実践
# ↑ It contains non-ASCII character in directory name
% ls *.md
-rw-r--r-- 1 seiya.yazaki staff 1.6K 6 24 15:07 slide.md
% yarn marp --server .
yarn run v1.17.0
$ '/Users/seiya.yazaki/work/github.com/saiya/presentations/190913 RDBMS 実践/node_modules/.bin/marp' --server .
Usage:
marp [options] <files...>
marp [options] -I <dir>
Basic Options:
--version, -v Show versions [真偽]
--help, -h Show help [真偽]
.... snip ....
yarn marp --server .
should start server, not showing help.
Use ASCII directory name:
% pwd
/Users/seiya.yazaki/work/github.com/saiya/presentations/190913 RDBMS Advanced
% ls *.md
-rw-r--r-- 1 seiya.yazaki staff 1.6K 6 24 15:07 slide.md
% yarn marp --server .
yarn run v1.17.0
$ '/Users/seiya.yazaki/work/github.com/saiya/presentations/190913 RDBMS Advanced/node_modules/.bin/marp' --server .
[ INFO ] [Server mode] Start server listened at http://localhost:8080/ ...
I am using an Ubuntu shell inside Windows (Windows Subsystem for Linux). Running --server
and --html
works but when I try --pdf
or --pptx
the command continues forever and I never get the cursor back.
Any idea how to troubleshoot this?
I would love to see --theme support online URL's
A focus ring will be kept on the clicked next button on OSC, so space bar brings unexpected twice navigation.
It is same for the other buttons. For example, slide cannot navigate with space bar after clicked previous button. Buttons for bespoke OSC plugin should not keep focus ring.
The PPTX output is awesome, but I am having an issue with 2 features. If this is explained somewhere, can you please point me to it.
1- The generated slides are actually creating unique Master Slides and then the slide on the front end is using that Master Slide Template (for example, Slide 1 is using Master Slide 1 and Slide 2 is using Master Slide 2). I was hoping that it would generate a regular slide. There is probably a good reason for this. The secondary issue with this, is if we actually apply a Master Theme to the Slide Deck, the elements of the Master Theme sit on top of the text/table/etc generated by MARP.
By the way, don't take this as negatives. I freaking love the project. Thank you for all of your effort.
Hello @yhatt,
Could it be possible to provide a flag to stop the one-by-one appearance of bullets/lists in html format? I basically want to have my entire list appear at once without having to press 'next' multiple times.
Thanks!
Hi, I have trouble with marp. It works fine last week, but it throw errors as follows this week. Please help. Thanks.
My env info:
npm: 6.9.0
node: 10.16.0
marp-cli: @marp-team/marp-cli v0.16.2 (w/ @marp-team/marp-core v0.15.2)
browser: Chrome canary Version 81.0.3991.0 (Official Build) canary (64-bit)
npx @marp-team/marp-cli foo.md --preview
[ INFO ] Converting 1 markdown...
[ INFO ] foo.md => foo.html
[ INFO ] [Watch mode] Start watching...
[ INFO ] [Preview] (EXPERIMENTAL) Opening
file:///Users/zhaozhiming/Documents/foo...
(node:36765) UnhandledPromiseRejectionWarning: Error: Protocol error (Browser.grantPermissions): Unknown permission type: clipboardRead
.......
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:36985) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:36985) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
V0.12.0: Program open the window and closed directly under windows10 (64)
I still enjoy the old desktop version and wonder if my old slides can migrate to marp-cli well.
Thanks!
I have the following files.
engine.js
const { Marp } = require('@marp-team/marp-core');
module.exports = opts => new Marp(opts);
Note: I've also tested module.exports = opts => new Marp();
, but there seems no difference.
sample.md
# test
` ` ` <- We cannot use triple backquoations in clode blocks so I use ` ` ` here instead
console.log('Hello World!');
` ` `
package.json
...
"devDependencies": {
"@marp-team/marp-cli": "0.14.1",
"@marp-team/marp-core": "0.13.1",
"@marp-team/marpit": "1.4.0",
...
When I use --engine @marp-team/marp-core
, it works well.
Interestingly, when I use --engine ./engine.js
, it doesn't render the code block well as follows.
Now we have already enabled Chrome's BGPT feature in all conversions. (#176 (comment)) Probably removing CSS hack for scaling (#15) makes no problems.
translateZ hack might still cause the glitch at remaining space in scaled slide.
We would remove these hacks if Chrome became to generate property trees by default. Until then we have to choice between to allow glitch on Chrome or to force enabling Chrome option.
Originally posted by @yhatt in #15 (comment)
The same workaround is still applicable in glitched <video>
tag on Chromium (marp-team/marpit#205 (comment)). We should apply this in Marpit framework.
By change of #143, Marp Core's auto-fitting elements in inactive slides will vanish when exporting PDF.
I think that may not calculate the size of hidden elements.
Will there ever be an option to have a presenter view in the HTML slide show, or to have a “pen” to draw on the slides?
Sorry if this is in the wrong project again—let me know if there’s a better place.
portfinder
's breaking reported in #134 was an unexpected trouble, but it tells us to prevent using port number > 40000. That has a good reason exaplined at http-party/node-portfinder#82 (comment).
Marp CLI is using 52000 port resolved by portfinder. We think it would be deprecated soon. So we have to change the base port for sending signals.
using following command
npx @marp-team/marp-cli slides.md -o slides.pdf
image could be successfully viewed in VS code with following syntax
after execute the command above, the pdf shows a img thumbnail instead of the image itself.
like this
but once you upload you image to some web host, it works, seems the problem here is Marp Cli doesn't support local images
Is there a way of enabling auto-scaling for code within markdown slides? I've tried a couple of things, but none seem to work. I'm using the default theme.
$ touch "test(1).md"
$ marp "test(1).md"
[ WARN ] Not found processable Markdown file(s).
...
It has reproduced in Windows and macOS. I'm guessing caused by confusion with glob pattern.
Microsoft has started rolling out new Edge browser based on Chromium. It will gradually be made available on Windows Update.
This fact is lucky for Marp CLI. PDF/PPTX conversion and preview mode has to install an extra Chrome/Chromium browser. Currently, it also works with Edge by setting CHROME_PATH
environment variable.
It means the most of Windows 10 user will get the compatible browser without to do anything by user. If Marp CLI was supported fallback to Edge, installing extra browser won't be needed when converting Markdown into PDF/PPTX.
When presenting slide deck HTML in Safari, too many navigations per 30 seconds bring SecurityError.
[Error] SecurityError: Attempt to use history.replaceState() more than 100 times per 30.000000 seconds
replaceState (yhatt-marp-cli-example.netlify.com:39:8347)
(anonymous function) (yhatt-marp-cli-example.netlify.com:39:8347)
(anonymous function) (yhatt-marp-cli-example.netlify.com:39:500)
reduce
s (yhatt-marp-cli-example.netlify.com:39:2575)
(anonymous function) (yhatt-marp-cli-example.netlify.com:39:2664)
(anonymous function) (yhatt-marp-cli-example.netlify.com:39:500)
reduce
u (yhatt-marp-cli-example.netlify.com:39:628)
u
(anonymous function) (yhatt-marp-cli-example.netlify.com:39:5580)
It's a restriction for security by Safari so we can only follow this. However, we can handle this error with wrapping by try
to avoid prevention of remaining works.
When I'm adding animated gif to my presentation like this:
---
<!--
_class:
-->
<style scoped>
section img{
position: absolute;
right: 0;
bottom: 0;
}
</style>
![bg left:30% fit](images/VM.png)
# Django
- А где логика?
![](images/7VE.gif)
They are being displayed correctly in html, but not in PPTX/PDF, there they are just static images.
I use HTML tags in my presentation to include an image and show it on the right side. Everything works fine while using the marp editor, but when I would like to build it with the CLI version, the HTML tags are not evaluated. Not in server
or preview
mode and not with allow-local-files
and not with pdf
or html
output.
The pdf gets render correctly only when using the Export to pdf
method in the marp editor itself.
Would be great if you could give me a hint. Here are some screenshots of the problem:
marp --pdf --allow-local-files Abstrakteklassen.md
Marp CLI build command
I've received many feedbacks about rendering the local image file, "Image does not see on rendered PDF". In most cases, a cause is lacking --allow-local-files
option.
Accessing the local content is often targeted as a vulnerability, so the user must express intention by the option. However, Marp CLI has not explained this while converting.
It's good to tell that it might lack --allow-local-files
option if detected blocking access to the local file. Of course, we should keep in mind that it's just a hint and must keep not to recommend.
We don't yet try for detection, but I wonder if Chrome outputs any warnings with its reason when blocked loading image. We should listen to Chrome error through Puppeteer, and detect local file access.
Hello.
I'm ganariya who studies in Akita University.
I'd like to use marp-cli to make a slide by markdown.
And I tired to use image syntax
But, If I use
marp --html --server --watch --allow-local-files
above server funtion, image cannot reveal.
However, If I export pdf, I can see image on the pdf.
Can marp-cli's server render user's local images?
Thank you.
The current release no longer renders an external CSS theme properly. I am not sure when this broke, but I'd guess sometime in the last few months.
It is possible that Puppeter and Chromium are out of sync again in marp-cli
, but the last time that happened the rendering completely hung. The initial time this happened was here: #73
It was reported in marp-team/marp-vscode#64. (marp-team/marp-vscode#64 (comment))
We cannot yet identify this cause. The following is a list of concerns that might be possible to be a cause.
<base>
HTML element would have wrong encodingAs I have been pointed out at #68, it is great to get converting the slide deck into multiple images. We want to provide the easiest way to create sequence images.
Converter
to support multiple output--images
?)--page
option (In another PR)A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.