npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@fileverse-dev/md2slides

v0.0.9

Published

Convert Markdown to HTML / PDF slides with customizeable pagination and styles. Standardized for compatibility with most editors.

Downloads

848

Readme

Fileverse MD2Slides

Convert Markdown to HTML / PDF slides with customizeable pagination and styles. Standardized for compatibility with most editors.

Download the package below or use the app directly: ddocs.new (live 12/12/24)

ddocs.new is a privacy preserving and decentralized alternative to gDocs created by @fileverse.

Quick examples:

  • Upload or paste Markdown text to automatically convert it to slides using standardized conversion rules (see below).
  • Modify the slides pagination using === to indicate page breaks.
  • Modify the style of your text
  • Access a simple UI (improved CSS) to visualize your md text and how it converts into slides
  • Visualize and export slides to HTML or PDF

Installation

npm install @fileverse-dev/md2slides

Basic Usage

import { convertMarkdownToHTML } from '@fileverse-dev/md2slides';

const markdown = `
# Slide 1
This is the first slide

===

# Slide 2
This is the second slide
`;

const html = convertMarkdownToHTML(markdown);

Configuration

The convertMarkdownToHTML function accepts two parameters:

  • markdown: Your markdown content (required)
  • options: Configuration object (optional)
type Options = {
  preserveNewlines: boolean;  // Preserve line breaks in the output
  sanitize: boolean;         // Sanitize HTML input
  maxCharsPerSlide: number;  // Maximum characters per slide
  maxWordsPerSlide: number;  // Maximum words per slide
  maxLinesPerSlide: number;  // Maximum lines per slide
};

Default options:

{
  preserveNewlines: true,
  sanitize: true,
  maxCharsPerSlide: 1000,
  maxWordsPerSlide: 250,
  maxLinesPerSlide: 7,
}

Styling

The library includes optional default styles that you can import:

With CSS Modules/Preprocessors

@import '@fileverse-dev/md2slides/styles';

With Plain HTML

<link rel="stylesheet" href="md2slides.css"/>

Browser Usage

For plain HTML/JavaScript projects:

  1. Build the library:
npm run build
  1. Include the built files in your HTML:
<script src="dist/index.min.js"></script>
<link rel="stylesheet" href="dist/md2slides.css"/>
  1. Use the global md2slides object:
const html = window.md2slides.convertMarkdownToHTML(`
# My Presentation
First slide content

===

## Second Slide
- Point 1
- Point 2
`);

document.getElementById('slides').innerHTML = html;

Automatic conversion rules from Markdown to slides

  • H1 = Always on one slide (Title slide)

  • H2 = Always starts a slide, until the next H2 (Acts as a page breaker)

  • H3 = Normal slide text (Paragraph text)

  • If the content doesn’t fit the container, it continues to the next slide

  • Images = maintaining the ratio of the original image and resizing to fit

  • If one page break, contains only one image, the image takes up the full slide

  • If there is an image with H2, H3 the image has a fixed side and placement

  • Page breaker = Separates content into separate slides based on the break

Roadmap & open issues:

We will be improving on this package and UI in the coming weeks based on people’s feedback. We plan on focusing on the following items first and have some open issues for which we encourage contributions:

  • Diagram and charting integration (eg. Mermaid)
  • Improve pagination rules
  • Improve image support
  • Improve styling for tables
  • Replace “Print” for PDF with "Download as PDF”
  • CLI support
  • Dark mode for slides

Acknowledgments:
This repository is inspired by earlier work of @vbuterin’s available here