@raspberrypifoundation/rpf-markdown-core
v0.2.2
Published
JS library to parse markdown and return HTML.
Keywords
Readme
rpf-markdown
JS library to parse markdown and return HTML.
Current features
- Code blocks formatted using prism JS
- projects site custom blocks like task, tip and debug
- scratchblocks
- Raspberry Flavoured Markdown as outlined in this spec
Add to your project
Install the package from npm using Yarn or npm:
yarn add @raspberrypifoundation/rpf-markdown-corenpm install @raspberrypifoundation/rpf-markdown-coreExample usage
import { processEditorProject } from "@raspberrypifoundation/rpf-markdown-core";
// processEditorProject returns the HTML for the markdown passed into it.
const exampleMarkdown = `# Hello World`;
const htmlOutput = processEditorProject(exampleMarkdown);
// Some options are available:
// Force high contrast mode for Scratch blocks in the markdown (Scratch 3 blocks only)
const htmlOutput2 = processEditorProject(someMarkdownWithScratch3Blocks, {scratchblocks: { highContrast: true }});
// Scale the Scratch blocks (default 1; must be a positive number)
const htmlOutput3 = processEditorProject(someMarkdownWithScratchBlocks, {scratchblocks: { scale: 1.5 }});Development setup
This project uses the Node version specified in .tool-versions. Node is managed by asdf. Yarn is provided by Corepack, which selects the version specified by packageManager in package.json.
Node and Yarn setup
asdf install
corepack enable
asdf reshim nodejs
yarn --versionInstall dependencies
yarn installRun the build in watch mode
yarn devTest unreleased changes locally
Create a package archive from this repository. The prepack script builds the library automatically:
yarn pack --out rpf-markdown-core.tgzThen install the archive in the target project:
yarn add @raspberrypifoundation/rpf-markdown-core@file:/path/to/rpf-markdown-core.tgzReleasing a new version
- Create a new PR to bump the version in
package.json. - Merge the PR.
- Create a new GitHub Release with a tag matching the version in
package.json. - The package will be published automatically to npm and GitHub Packages.
