Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

Repository files navigation

CartaNova 🖋️

A lightweight, dependency-free Markdown to HTML converter.

CartaNova logo

CartaNova takes plain Markdown text and transforms it into semantic, standards-compliant HTML.
It’s small enough to embed in a single file, yet supports most Markdown syntax — including tables, task lists, inline code, and more.

GitHub repository: enreeco/cartanova-markdown-js


✨ Features

  • Headings (# through ######)
  • Paragraphs and line breaks
  • Emphasis styles:
    • bold, italic, ++underline++, strikethrough, ==highlight==, ^superscript^, subscript
  • Blockquotes (>)
  • Lists
    • Ordered, unordered, and [ ] / [x] task lists
  • Definition lists (Term: Definition)
  • Inline and fenced code blocks (language hints ignored)
  • Links and images
  • Horizontal rules (---, ***, ___)
  • Tables with column alignment (:---, :---:, ---:)
  • Safe by default — raw HTML is escaped

🚀 Quick Start

Include the parser and its default CSS in your page:

<link rel="stylesheet" href="markdownlite.css">
<script src="markdownlite.js"></script>

Then render Markdown:

<div class="mdlite" id="output"></div>
<script>
  const md = `
  # Hello Markdown
  This **text** was parsed by *CartaNova*.
  `;

  document.getElementById('output').innerHTML = MarkdownLite.parse(md);
</script>

All output is wrapped in the .mdlite namespace, so the included markdownlite.css styles won’t clash with your site.


🧰 API

MarkdownLite.parse(markdownText: string): string

Converts Markdown into sanitized HTML.

MarkdownLite.renderTo(markdownText: string, element: HTMLElement)

Renders Markdown directly into a DOM element.


🎨 CSS Namespace

CartaNova’s HTML is wrapped inside .mdlite. You can safely override the default look by redefining these rules in your own stylesheet.

Example:

.mdlite h1 { color: crimson; }
.mdlite blockquote { border-left-color: gold; }

🧩 Extending the Parser

The code is intentionally modular — each Markdown feature has a small, well-scoped parser function:

  • parseBlocks() handles block structure
  • renderInline() manages inline patterns
  • You can inject new syntax rules by adding functions and integrating them in the main parser loop

Example: adding custom shortcodes or new inline transforms takes only a few lines.


🧠 Philosophy

CartaNova’s purpose is clarity. It doesn’t try to emulate every edge case of CommonMark — instead it provides predictable, human-readable HTML suitable for editors, note-taking apps, or static site generators.

Think of it as “a new sheet of paper” — elegant, minimal, and under your control.


📄 License

MIT © 2025 — Created with curiosity and caffeine.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages