This project provides an API for converting Markdown to various presentation formats using Marp.
- Convert Markdown to PDF, PPTX (slides as static images), or HTML
- Customizable output options
- Dockerized for easy deployment
Choose one of the following installation methods:
Option 1: Docker
- Make sure you have Docker installed on your system.
- Clone this repository:
git clone https://github.com/pvanand07/Marpit-API-HTML-Presentation.git cd marp-api
- Build and run the Docker container:
docker build -t marp-api . docker run -p 3000:3000 marp-api
Option 2: Docker Compose
- Ensure you have Docker and Docker Compose installed.
- Clone this repository:
git clone https://github.com/pvanand07/Marpit-API-HTML-Presentation.git cd marp-api
- Run the application using Docker Compose:
docker-compose up
Option 3: NPM
- Make sure you have Node.js (version 16 or later) and npm installed.
- Clone this repository:
git clone https://github.com/pvanand07/Marpit-API-HTML-Presentation.git cd marp-api
- Install dependencies:
npm install
- Start the server:
npm start
Option 4: Hugging Face Spaces
To deploy this project on Hugging Face Spaces:
- Create a new space on Hugging Face Spaces with a blank docker template
- Upload the files or clone from this repo.
- Edit the README.md file to include only the following content:
---
title: Marpit Backend
emoji: 👁
colorFrom: pink
colorTo: purple
sdk: docker
pinned: false
---
This metadata is required for Spaces to recognize and properly deploy your Docker-based application.
Send a POST request to the /convert
endpoint with the following JSON payload:
{
"markdown": "Your Markdown content here",
"outputFormat": "pdf",
"options": ["--theme", "gaia"]
}
markdown
: The Markdown content to convertoutputFormat
: The desired output format (pdf
,pptx
, orhtml
)options
: An array of additional Marp CLI options (optional)
Example using cURL:
curl -X POST -H "Content-Type: application/json" -d '{"markdown": "# Hello World", "outputFormat": "pdf"}' http://localhost:3000/convert > output.pdf
POST /convert
: Convert Markdown to the specified output format
The server listens on port 3000 by default. You can change this by setting the PORT
environment variable.
- Express.js
- @marp-team/marp-cli
- Puppeteer
The included Dockerfile sets up the environment with Node.js, Chrome, and necessary fonts for rendering various character sets.
Contributions are welcome! Please feel free to submit a Pull Request.
Documentation from official Marpit repo
Marpit /mɑːrpɪt/ is the skinny framework for creating slide deck from Markdown. It can transform Markdown and CSS theme(s) to slide deck composed of static HTML and CSS and create a web page convertible into slide PDF by printing.
Marpit is designed to output minimum assets for the slide deck. You can use the bare assets as a logicless slide deck, but mainly we expect to integrate output with other tools and applications.
In fact, this framework is created for using as the base of a core converter in Marp ecosystem.
We have extended several features into markdown-it parser to support writing awesome slides, such as Directives and Slide backgrounds. Additional syntaxes place importance on a compatibility with general Markdown documents.
Marpit has the CSS theming system that can design slides everything. Unlike other slide frameworks, there are not any predefined classes and mixins. You have only to focus styling HTML elements by pure CSS. Marpit would take care of the selected theme's necessary conversion.
📐 Inline SVG slide (Experimental)
Optionally <svg>
element can use as the container of each slide page. It can be realized the pixel-perfect scaling of the slide only by CSS, so handling slides in integrated apps become simplified. The isolated layer made by <foreignObject>
can provide advanced backgrounds for the slide with keeping the original Markdown DOM structure.
We not provide any themes because Marpit is just a framework. You can use @marp-team/marp-core if you want. It has the official themes, and practical features extended from Marpit.
See the documentation of Marpit to get started.
This framework releases under the MIT License.