Security News
Bun 1.2 Released with 90% Node.js Compatibility and Built-in S3 Object Support
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
markdown-slideshow
Advanced tools
Convert a markdown document into an HTML and JS based slideshow. Each top level header represents a new slide.
Convert a markdown document into an HTML and JS based slideshow.
The markdown file should follows some simple rules:
#
level headers are ignored by default, they should be used for dictating structure in your presentation##
level headers indicate a new slide, they are also the primary header for the new slide. Headers can end in ID:SOME_STRING
to denote a unique identifier for that header. This can then be used for the sectionPreprocess
configuration (see below).<html>
<head>
<title>Markdown Slideshow Demo</title>
<link href="../node_modules/prismjs/themes/prism.css" rel="stylesheet"> </link>
<script src="../node_modules/jquery/dist/jquery.min.js"> </script>
<script src="../node_modules/showdown/dist/showdown.min.js"> </script>
<script src="../node_modules/prismjs/prism.js"> </script>
<script src="../node_modules/markdown-presentation/src/markdown-presentation.js"> </script>
</head>
<body>
<div class="presentation-parent"> </div>
<script>
var pres = new MarkdownPresentation({
presentationElement: '.presentation-parent',
data: mySlideData
});
pres.start();
</script>
</body>
</html>
{
presentationElement: '.foo',
data: `
# Intro
## Slide 1
## Slide 2
# Closing
## Slide 3 ID: slide3
`,
sectionPreprocess: {
'slide3': function() {
// Do some stuff when the slide is opened
return function() {
// Do some stuff when the slide is closed
}
}
}
}
If you wish to use a separate .md
file for your slide document, you will either
need to manually copy over the markdown into JavaScript, run the code on a local
or remote webserver, or use something like Grunt to manage the copying for you.
To help with the setup, I've included an example grunt config below, this uses
fs
and grunt-replace
. This set up assumes you name the markdown file and
the resulting
var sourceFile = './presentation';
var destinationDir = './dist';
var fs = require('fs');
var markdown = fs.readFileSync(sourceFile + '.md', { encoding: 'utf8' });
markdown = markdown.replace(/```/g, '\\`\\`\\`');
module.exports = function (grunt) {
var config = {
replace: {
dev: {
options: {
patterns: [
{
match: 'MARKDOWN',
replacement: markdown
}
],
},
files: [{
src: [sourceFile + '.js'],
dest: destinationDir
}]
}
}
};
}
var data =
`
@@MARKDOWN
`;
FAQs
Convert a markdown document into an HTML and JS based slideshow. Each top level header represents a new slide.
We found that markdown-slideshow demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.