All Projects → marknote → MarknoteParser

marknote / MarknoteParser

Licence: other
A high performance markdown parser in Swift.

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to MarknoteParser

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 (+18010.34%)
Mutual labels:  parse, markdown-parser
tparse
time parsing library for Go; supports more time units than standard library
Stars: ✭ 42 (+44.83%)
Mutual labels:  parse
exjson
JSON parser and genarator in Elixir.
Stars: ✭ 71 (+144.83%)
Mutual labels:  parse
pixie
Tiny template functions.
Stars: ✭ 14 (-51.72%)
Mutual labels:  parse
snapdragon-lexer
Converts a string into an array of tokens, with useful methods for looking ahead and behind, capturing, matching, et cetera.
Stars: ✭ 19 (-34.48%)
Mutual labels:  parse
extract-domain
Extract domain name from an URL
Stars: ✭ 22 (-24.14%)
Mutual labels:  parse
pfp-vim
A vim hex-editor plugin that uses 010 templates to parse binary data using pfp
Stars: ✭ 57 (+96.55%)
Mutual labels:  parse
twkb
A small GO parser for the TWKB format
Stars: ✭ 17 (-41.38%)
Mutual labels:  parse
node-red-contrib-string
Provides a string manipulation node with a chainable UI based on the concise and lightweight stringjs.com.
Stars: ✭ 15 (-48.28%)
Mutual labels:  parse
htmlup
light and fast markdown parser
Stars: ✭ 48 (+65.52%)
Mutual labels:  markdown-parser
SwiftDomainParser
A Full Swift Lightweight Framework that uses the Public Suffix list to Parse URLs
Stars: ✭ 48 (+65.52%)
Mutual labels:  parse
flex-bison-indentation
An example of how to correctly parse python-like indentation-scoped files using flex (and bison).
Stars: ✭ 32 (+10.34%)
Mutual labels:  parse
parse-react
[EXPERIMENTAL] React, React Native, and React with SSR (e.g. Next.js) packages to interact with Parse Server backend
Stars: ✭ 58 (+100%)
Mutual labels:  parse
sitemapper
parses sitemaps for Node.JS
Stars: ✭ 70 (+141.38%)
Mutual labels:  parse
eslump
Fuzz testing JavaScript parsers and suchlike programs.
Stars: ✭ 56 (+93.1%)
Mutual labels:  parse
read-env
🔧 Transform environment variables into JSON object with sanitized values.
Stars: ✭ 60 (+106.9%)
Mutual labels:  parse
parse-git-config
Parse `.git/config` into a JavaScript object. sync or async.
Stars: ✭ 55 (+89.66%)
Mutual labels:  parse
postcss-styl
PostCSS parser plugin for converting Stylus syntax to PostCSS AST.
Stars: ✭ 15 (-48.28%)
Mutual labels:  parse
golgi
A composable routing library for Haxe.
Stars: ✭ 37 (+27.59%)
Mutual labels:  parse
python-fastimport
Git Fastimport parser and generator in Python
Stars: ✭ 19 (-34.48%)
Mutual labels:  parse

MarkNote Parser

Objective-C version: https://github.com/marknote/MarkNoteParserObjC

Swift version: https://github.com/marknote/MarknoteParser

A dead simple markdown parser implemented in both Swift and Objective-C with performance in mind, which can help you to transform markdown code into HTML.
Most of markdown parsers highly depend on regular expression while MarkNote Parser avoids doing so.

Purpose

At the beginning my app MarkNote was using marked to render markdown as HTML.
After trying to find a relevant markdown parser in Swfit/Object-c while no luck, I decided to build my own.

Usage

Using swift version

  • Cope 2 files into your project:
    -- StringExtensions.swift , extension of String class;
    -- MarkNoteParser.swift, the parser class;

  • Use the method MarkNoteParser.toHtml to convert markdown text to HTML string, like this:

func markdown(input :String)->String{
        let result = MarkNoteParser.toHtml(input)
        println("input: \(input) result:\(result)")
        return result
    }

Using objetive-c version

  • Cope all files under "MarkNoteParserOC" folder into your project, and import the header file like this
#import "MarkNoteParser.h"
  • Then you can call MarkNoteParser to parse your markdown document:
NSString* result = [MarkNoteParser toHtml:input];
return result;

Features

headers

# H1
## H2
### H3

will be transformed into:

<h1>H1</h1><h2>H2</h2><h3>H3</h3>

Emphasis

Emphasis, aka italics, with *asterisks* or _underscores_.
Strong emphasis, aka bold, with **asterisks** or __underscores__.
Strikethrough uses two tildes. ~~Scratch this.~~

will be transformed into:

<p>Emphasis, aka italics, with <em>asterisks</em> or <em>underscores</em>.<br/></p>
<p>Strong emphasis, aka bold, with <strong>asterisks</strong> or <strong>underscores</strong>.<br/></p>
<p>Strikethrough uses two tildes. <u>Scratch this.</u><br/></p>

Links

[I'm an inline-style link](https://www.google.com)
[I'm an inline-style link with title](https://www.google.com "Google's Homepage")

will be transformed into:

<p><a href="https://www.google.com">I'm an inline-style link</a><br/></p>
<p><a href="https://www.google.com" title="Google's Homepage">I'm an inline-style link with title</a><br/></p>

Images

![alt text](https://avatars3.githubusercontent.com/u/12975088?v=3&s=40 "Logo Title")

will be transformed into:

<img src="https://avatars3.githubusercontent.com/u/12975088?v=3&s=40" title="Logo Title" alt="alt text" />

Code

```
var s = "JavaScript syntax highlighting";
alert(s);
```

will be transformed into:

<pre class="lang-javascript">
var s = &quot;JavaScript syntax highlighting&quot;;
alert(s);
</pre>

Table

| Tables        | Are           | Cool  |
| ------------- |:-------------:| -----:|
| col 3 is      | right-aligned | $1600 |
| col 2 is      | centered      |   $12 |
| zebra stripes | are neat      |    $1 |

will be transformed into:

<table><tr><th> Tables        </th><th> Are           </th><th style="text-align: center;"> Cool </th></tr><tr><td> col 3 is      </td><td> right-aligned </td><td style="text-align: center;"> $1600 </td></tr><tr><td> col 2 is      </td><td> centered      </td><td style="text-align: center;">   $12 </td></tr><tr><td> zebra stripes </td><td> are neat      </td><td style="text-align: center;">    $1 </td></tr></table><p>The outer pipes (|) are optional, and you don&#39;t need to make the raw Markdown line up prettily. You can also use inline Markdown.<br/></p>

Feedback

If you have any suggestion or feedback, feel free to drop me a message or follow me on twitter @markmarknote

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