Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/faxes/markdownconvert
Convert Markdown to HTML using mdconvert!
https://github.com/faxes/markdownconvert
html markdown markdown-parser markdown-to-html parser
Last synced: about 2 months ago
JSON representation
Convert Markdown to HTML using mdconvert!
- Host: GitHub
- URL: https://github.com/faxes/markdownconvert
- Owner: FAXES
- License: mit
- Created: 2023-01-29T11:06:50.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-09-29T22:12:31.000Z (3 months ago)
- Last Synced: 2024-10-29T10:42:39.410Z (about 2 months ago)
- Topics: html, markdown, markdown-parser, markdown-to-html, parser
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/markdownconvert
- Size: 180 KB
- Stars: 4
- Watchers: 1
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Markdown Convert
Markdown convert is a conversion tool used to, you guessed it, convert markdown to HTML.
- 🐈 Markdown to HTML parser
- ⚡Built differently, for performance
- ⚖️ light-weight while also having custom markdown conversions built-in
- 🔥 Support for [HTTP request blocks](https://docs.weblutions.com/c/products/md-guide-http) to be rendered with custom Markdown
- 🪴 Remove markdown syntax and get the text content - all without the asterisks and underscores## Installation
Get started by running the install command 😊
```
npm install markdownconvert
```## Usage
Currently, you can use markdownconvert in the following ways.**Node.js**
```js
const mdconvert = require('markdownconvert');let string = "This is some **cool** Markdown to **HTML**, generated by `markdownconvert` for ~~me~~ you.";
let converted = mdconvert.convert(string);
/* Output:This is some cool Markdown to HTML, generated by
markdownconvert
for me you.
*/
```## Current Functions
```js
convert(string, options) // Converts Markdown to HTML.
render(string, options) // Another function name, same as convert()registerBlock({open: 'optional', close: 'optional', exec: function}) // Registers a block replacement that is executed, good for custom addons
registerInline({open: 'optional', close: 'optional', exec: function}) // Registers an in-line block replacement. Again, good for custom addonsgetStyle(index, returnClassEquals) // Returns the registered style (class name) for the associated element, returnClassEquals will return the style as ' class="class_name"'.
updateStyle(index, newProperty) // Create or overwrite existing style for the defined element
```## Options
```js
options.sanitize // Sanitizes the function, removing any HTML script tags.
options.plainText // Removes markdown formatting so the plain text is returned without formatting or syntax.
```
Both of these default to `false`.## Modifying Styles
Markdownconvert allows you to change the CSS properties of a tag to allow your own customisation. There's a list of [Default Styles](https://github.com/FAXES/markdownconvert/wiki/Default-Styles) available.To update a style you can use the `updateStyle()` function.
```js
const mdconvert = require('markdownconvert');
mdconvert.updateStyle('contDanger', 'converterDangerCSS');// To fetch this property you can use the `getStyle()` function
mdconvert.getStyle('contDanger');
```
*If `contDanger` wasn't found in the list, it would be created and added, which is perfect for adding your own rules with `registerBlock()` or `registerInline()`.*## Change-log
Get all the latest changes at [github.com/FAXES/markdownconvert/releases](https://github.com/FAXES/markdownconvert/releases)## Authors
Markdownconvert is created by [Weblutions & FAXES](https://weblutions.com).