All Projects → icyleaf → Markd

icyleaf / Markd

Licence: mit
Yet another markdown parser, Compliant to CommonMark specification, written in Crystal.

Programming Languages

crystal
512 projects

Projects that are alternatives of or similar to Markd

Remarkable
Markdown parser, done right. Commonmark support, extensions, syntax plugins, high speed - all in one. Gulp and metalsmith plugins available. Used by Facebook, Docusaurus and many others! Use https://github.com/breakdance/breakdance for HTML-to-markdown conversion. Use https://github.com/jonschlinkert/markdown-toc to generate a table of contents.
Stars: ✭ 5,252 (+7094.52%)
Mutual labels:  markdown, commonmark, gfm
Turndown
🛏 An HTML to Markdown converter written in JavaScript
Stars: ✭ 5,991 (+8106.85%)
Mutual labels:  markdown, gfm, commonmark
Vditor
♏ 一款浏览器端的 Markdown 编辑器。
Stars: ✭ 1,742 (+2286.3%)
Mutual labels:  markdown, commonmark, gfm
Breakdance
It's time for your markup to get down! HTML to markdown converter. Breakdance is a highly pluggable, flexible and easy to use.
Stars: ✭ 418 (+472.6%)
Mutual labels:  markdown, commonmark, gfm
Micromark
the smallest commonmark compliant markdown parser that exists; new basis for @unifiedjs (hundreds of projects w/ billions of downloads for dealing w/ content)
Stars: ✭ 793 (+986.3%)
Mutual labels:  markdown, commonmark, gfm
Awesome Markdown
📝 Delightful Markdown stuff.
Stars: ✭ 451 (+517.81%)
Mutual labels:  markdown, commonmark, gfm
Tui.editor
🍞📝 Markdown WYSIWYG Editor. GFM Standard + Chart & UML Extensible.
Stars: ✭ 14,016 (+19100%)
Mutual labels:  markdown, commonmark, gfm
Editor.md
The open source embeddable online markdown editor (component).
Stars: ✭ 11,741 (+15983.56%)
Mutual labels:  markdown, commonmark, gfm
React Markdown
Markdown component for React
Stars: ✭ 8,047 (+10923.29%)
Mutual labels:  markdown, commonmark, gfm
Lute
🎼 一款结构化的 Markdown 引擎,支持 Go 和 JavaScript。
Stars: ✭ 211 (+189.04%)
Mutual labels:  markdown, commonmark, gfm
Commonmark
Highly-extensible PHP Markdown parser which fully supports the CommonMark and GFM specs.
Stars: ✭ 2,128 (+2815.07%)
Mutual labels:  markdown, commonmark, gfm
Lute
🎼 一款对中文语境优化的 Markdown 引擎,支持 Go 和 JavaScript。A structured Markdown engine that supports Go and JavaScript.
Stars: ✭ 222 (+204.11%)
Mutual labels:  markdown, commonmark, gfm
Vditor
♏ 一款浏览器端的 Markdown 编辑器,支持所见即所得(富文本)、即时渲染(类似 Typora)和分屏预览模式。An In-browser Markdown editor, support WYSIWYG (Rich Text), Instant Rendering (Typora-like) and Split View modes.
Stars: ✭ 3,773 (+5068.49%)
Mutual labels:  markdown, commonmark, gfm
Markdig
A fast, powerful, CommonMark compliant, extensible Markdown processor for .NET
Stars: ✭ 2,730 (+3639.73%)
Mutual labels:  markdown, commonmark, gfm
Marked
A markdown parser and compiler. Built for speed.
Stars: ✭ 26,556 (+36278.08%)
Mutual labels:  markdown, commonmark, gfm
Commonmarkattributedstring
Create NSAttributedStrings from Markdown Text
Stars: ✭ 382 (+423.29%)
Mutual labels:  markdown, commonmark
Remark
remark is a popular tool that transforms markdown with plugins. These plugins can inspect and change your markup. You can use remark on the server, the client, CLIs, deno, etc.
Stars: ✭ 4,746 (+6401.37%)
Mutual labels:  markdown, commonmark
Liandi
📕 一款桌面端的 Markdown 块级引用和双向链接笔记应用,支持 Windows、Mac 和 Linux。A desktop Markdown Block-Reference and Bidirectional-Link note-taking application, supports Windows, Mac and Linux.
Stars: ✭ 354 (+384.93%)
Mutual labels:  markdown, gfm
Comrak
CommonMark + GFM compatible Markdown parser and renderer
Stars: ✭ 444 (+508.22%)
Mutual labels:  markdown, commonmark
Markdown Writer Fx
Markdown Writer FX
Stars: ✭ 323 (+342.47%)
Mutual labels:  markdown, commonmark

markd

Language Tag Build Status

Yet another markdown parser built for speed, written in Crystal, Compliant to CommonMark specification (v0.27). Copy from commonmark.js.

Installation

Add this to your application's shard.yml:

dependencies:
  markd:
    github: icyleaf/markd

Quick start

require "markd"

markdown = <<-MD
# Hello Markd

> Yet another markdown parser built for speed, written in Crystal, Compliant to CommonMark specification.
MD

html = Markd.to_html(markdown)

Also here are options to configure the parse and render.

options = Markd::Options.new(smart: true, safe: true)
Markd.to_html(markdown, options)

Options

Name Type Default value Description
time Bool false render parse cost time during read source, parse blocks, parse inline.
smart Bool false if true, straight quotes will be made curly,
-- will be changed to an en dash,
--- will be changed to an em dash, and
... will be changed to ellipses.
source_pos Bool false if true, source position information for block-level elements
will be rendered in the data-sourcepos attribute (for HTML)
safe Bool false if true, raw HTML will not be passed through to HTML output (it will be replaced by comments)
prettyprint Bool false if true, code tags generated by code blocks will have a prettyprint class added to them, to be used by Google code-prettify.
gfm Bool false Not supported for now
toc Bool false Not supported for now
base_url URI? nil if not nil, relative URLs of links are resolved against this URI. It act's like HTML's <base href="base_url"> in the context of a Markdown document.

Advanced

If you want to use a custom renderer, it can!

class CustomRenderer < Markd::Renderer

  def strong(node, entering)
  end

  # more methods following in render.
end

options = Markd::Options.new(time: true)
document = Markd::Parser.parse(markdown, options)
renderer = CustomRenderer.new(options)

html = renderer.render(document)

Performance

First of all, Markd is slower than Crystal Built-in Markdown which it is a lite version, only apply for generte Cystal documents (#4496, #4613).

Here is the result of a sample markdown file parse at MacBook Pro Retina 2015 (2.2 GHz):

Crystal Markdown   3.28k (305.29µs) (± 0.92%)       fastest
           Markd 305.36  (  3.27ms) (± 5.52%) 10.73× slower

Recently, I'm working to compare the other popular commonmark parser, the code is stored in benchmarks.

Donate

Markd is an open source, collaboratively funded project. If you run a business and are using Markd in a revenue-generating product, it would make business sense to sponsor Markd development. Individual users are also welcome to make a one time donation if Markd has helped you in your work or personal projects.

You can donate via Paypal.

How to Contribute

Your contributions are always welcome! Please submit a pull request or create an issue to add a new question, bug or feature to the list.

All Contributors are on the wall.

You may also like

  • halite - HTTP Requests Client with a chainable REST API, built-in sessions and middlewares.
  • totem - Load and parse a configuration file or string in JSON, YAML, dotenv formats.
  • poncho - A .env parser/loader improved for performance.
  • popcorn - Easy and Safe casting from one type to another.
  • fast-crystal - 💨 Writing Fast Crystal 😍 -- Collect Common Crystal idioms.

License

MIT License © icyleaf

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].