Skip to content

VukMar/maricmd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Maricmd Logo

MARICMD

Maricmd is a simple Markdown to HTML converter written in JavaScript. It allows you to easily convert Markdown text into HTML markup.

Installation

You can install maricmd via npm:

npm install maricmd

Usage

Common:

const maricmd = require('maricmd');

const markdownText = `
# Hello, world!

This is **bold** and *italic* text.

Here are [link1](https://www.example1.com) and [link2](https://www.example2.com) in one paragraph.

`;

const maricmdInstance = new maricmd(markdownText);

console.log("Elements:\n");
console.log(maricmdInstance.elements);

console.log("HTML:\n");
console.log(maricmdInstance.html);

Parsing Markdown Elements The maricmd function returns an object containing both the HTML markup (html) and an array of parsed Markdown elements (elements). You can use these elements to further manipulate or analyze the Markdown content in your application.

For example, you can iterate over the elements array to extract specific information or apply custom styling based on the Markdown structure.

Rendering HTML The html string generated by maricmd can be directly inserted into your HTML documents to render the Markdown content. You can use it within React components, server-side templates, or any other HTML-rendering environment.

For example, in a React component, you can render the HTML markup using the dangerouslySetInnerHTML attribute:

import React from 'react';
import maricmd from 'maricmd';

const MarkdownComponent = () => {
  const markdownText = `
# Hello, world!

This is **bold** and *italic* text.

Here are [link1](https://www.example1.com) and [link2](https://www.example2.com) in one paragraph.
`;

  const maricmdInstance = new maricmd(markdownText);

  return <div dangerouslySetInnerHTML={{ __html: maricmdInstance.html }} />;
};

export default MarkdownComponent;

Supported Markdown Elements

Below is a list of Markdown elements and their implementation status in maricmd:

  • Headings
  • Paragraphs
  • Emphasis (Italic and Bold)
  • Lists (Ordered and Unordered)
  • Links
  • Images
  • Code Blocks
  • Horizontal Rules
  • Blockquotes
  • Inline Code
  • Tables
  • Strikethrough
  • Task lists
  • Definition lists
  • Footnotes

Contributing

Contributions are welcome! Feel free to submit issues and pull requests.

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published