Coder Social home page Coder Social logo

braxtongpoll / markdownconvert Goto Github PK

View Code? Open in Web Editor NEW

This project forked from faxes/markdownconvert

0.0 0.0 0.0 83 KB

Convert Markdown to HTML using mdconvert!

Home Page: https://www.npmjs.com/package/markdownconvert

License: MIT License

JavaScript 69.06% CSS 19.83% HTML 11.11%

markdownconvert's Introduction

Markdown Convert

Markdown convert is a conversion tool used to, you guessed it, convert markdown to HTML.

  • 🐈 Markdown to HTML parser
  • ⚑Built different, for performance
  • βš–οΈ light-weight while also having custom markdown conversions built-in
  • ♾️ Works in browsers, clients, servers, and (soon) command line interfaces (CLI)
  • πŸ”₯ Support for HTTP request blocks to be rendered with custom Markdown

Planned; convert Markdown into regular string without Markdown formatting.

Installation

Get started by running the install command 😊

npm install markdownconvert

Usage

Currently you can use markdownconvert in the following ways.

Node.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:
<p>This is some <strong>cool</strong> Markdown to <strong>HTML</strong>, generated by <code>markdownconvert</code> for <s>me</s> you.</p>
*/

Browser

<script src="https://cdn.jsdelivr.net/npm/markdownconvert/index.min.js"></script>
<script>
    document.write(markdownconvert.convert("I **love** HTML don't *you*?"))
</script>

Current Functions

convert(string) // Converts Markdown to HTML
render(string) // Another function name, same as convert()

registerBlock(function) // Registers a block replacement that is executed, good for custom addons
registerInline(function) // Registers an in-line block replacement. Again, good for custom addons

getStyle(index) // Returns the registered style (class name) for the associated element
updateStyle(index, newProperty) // Create or overwrite existing style for the defined element

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 available.

To update a style you can use the updateStyle() function.

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, perfect for adding your own rules with registerBlock() or registerInline().

Combatibility

This works in modern broswers and in Node.js current and LTS versions.

Authors

Markdownconvert is created by Weblutions & FAXES.

Discord Invite

markdownconvert's People

Contributors

faxes avatar braxtongpoll avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.