All Projects → mmarkdown → Mmark

mmarkdown / Mmark

Licence: other
Mmark: a powerful markdown processor in Go geared towards the IETF

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to Mmark

Soupsieve
A modern CSS selector implementation for BeautifulSoup
Stars: ✭ 95 (-69.65%)
Mutual labels:  xml, html5
Markup.ml
Error-recovering streaming HTML5 and XML parsers
Stars: ✭ 122 (-61.02%)
Mutual labels:  xml, html5
Macsvg
macSVG - An open-source macOS app for designing HTML5 SVG (Scalable Vector Graphics) art and animation with a WebKit web view ➤➤➤
Stars: ✭ 789 (+152.08%)
Mutual labels:  xml, html5
Sheetjs
📗 SheetJS Community Edition -- Spreadsheet Data Toolkit
Stars: ✭ 28,479 (+8998.72%)
Mutual labels:  xml, html5
Texme
Self-rendering Markdown + LaTeX documents
Stars: ✭ 1,970 (+529.39%)
Mutual labels:  markdown, html5
Prettydiff
Beautifier and language aware code comparison tool for many languages. It also minifies and a few other things.
Stars: ✭ 1,635 (+422.36%)
Mutual labels:  xml, html5
Twital
Twital is a "plugin" for Twig that adds some sugar syntax, which makes its templates similar to PHPTal or VueJS.
Stars: ✭ 116 (-62.94%)
Mutual labels:  xml, html5
Preact Markup
⚡️ Render HTML5 as VDOM, with Components as Custom Elements!
Stars: ✭ 167 (-46.65%)
Mutual labels:  markdown, xml
Mdme
Self-rendering Markdown content
Stars: ✭ 140 (-55.27%)
Mutual labels:  markdown, html5
Nodeppt
This is probably the best web presentation tool so far!
Stars: ✭ 9,589 (+2963.58%)
Mutual labels:  markdown, html5
Uxdm
🔀 UXDM helps developers migrate data from one system or format to another.
Stars: ✭ 159 (-49.2%)
Mutual labels:  markdown, xml
Sq
swiss-army knife for data
Stars: ✭ 275 (-12.14%)
Mutual labels:  markdown, xml
Xxe Injection Payload List
🎯 XML External Entity (XXE) Injection Payload List
Stars: ✭ 304 (-2.88%)
Mutual labels:  xml
Coreui Free React Admin Template
CoreUI React is a free React admin template based on Bootstrap 5
Stars: ✭ 3,573 (+1041.53%)
Mutual labels:  html5
Markserv
🏁 serve markdown as html (GitHub style), index directories, live-reload as you edit
Stars: ✭ 304 (-2.88%)
Mutual labels:  markdown
Noteless
A Markdown-based note-taking app for mobile devices.
Stars: ✭ 302 (-3.51%)
Mutual labels:  markdown
Ghiblog
GitHub Issues Blog, powered by GitHub Issues and GitHub Actions
Stars: ✭ 313 (+0%)
Mutual labels:  markdown
Nb
CLI and local web plain text note‑taking, bookmarking, and archiving with linking, tagging, filtering, search, Git versioning & syncing, Pandoc conversion, + more, in a single portable script.
Stars: ✭ 3,846 (+1128.75%)
Mutual labels:  markdown
Pandoc Letter
Pandoc template for writing letters in markdown
Stars: ✭ 303 (-3.19%)
Mutual labels:  markdown
Egerpro
Eger Pro is based on the development of Egret HTML5 4.x game development solutions
Stars: ✭ 303 (-3.19%)
Mutual labels:  html5

title: "About" date: 2018-07-22T14:05:51+01:00 aliases: [/about/]

Build Status

Mmark is a powerful markdown processor written in Go, geared towards writing IETF documents. It is, however, also suited for writing complete books and other technical documentation, like the Learning Go book (mmark source, and I-D text output).

Also see this repository on how to write RFC using Markdown.

It provides an advanced markdown dialect that processes file(s) to produce internet-drafts in XML RFC 7991 format. Mmark can produce xml2rfc (aforementioned RFC 7991), RFC 7749 (xml2rfc version 2 - now deprecated), HTML5 output, markdown and manual pages.

Example RFCs in Mmark format can be found in the Github repository.

Mmark uses gomarkdown which is a fork of blackfriday. See its README.md for more documentation.

If you like Go and parsing text, drop me (mailto:[email protected]) a line if you want to be part of the Mmarkdown Github org, and help develop Mmark!

Syntax

Mmark's syntax and the extra features compared to plain Markdown are detailed in syntax.md.

Mmark adds the following syntax elements to gomarkdown/markdown:

Usage

You can download a binary or optionally build mmark your self. You'll need a working Go environment, then check out the code and:

% go get && go build
% ./mmark -version
2.0.0

To output XML2RFC v3 xml just give it a markdown file and:

% ./mmark rfc/3514.md

Making a draft in text form (v3 output)

% ./mmark rfc/3514.md > x.xml
% xml2rfc --v3 --text x.xml

Outputting HTML5 is done with the -html switch. Outputting markdown is done with the -markdown switch (optionally you can use -width to set the text width).

Example RFC

The rfc/ directory contains a couple of example RFCs that can be build via the v2 or v3 tool chain. The build the text files, just run:

cd rfc
make txt

Official RFCs are in rfc/orig (so you can compare the text output from mmark).

Using Mmark as a library

By default Mmark gives you a binary you can run, if you want to include the parser and renderers in your own code you'll have to lift some of it out of mmark.go.

Create a parser with the correct options and flags. The that init is used to track file includes. In this snippet we set if to fileName which is the file we're currently reading. If reading from standard input, this can be set to "".

p := parser.NewWithExtensions(mparser.Extensions)
init := mparser.NewInitial(fileName)
documentTitle := "" // hack to get document title from TOML title block and then set it here.
p.Opts = parser.Options{
    ParserHook: func(data []byte) (ast.Node, []byte, int) {
        node, data, consumed := mparser.Hook(data)
        if t, ok := node.(*mast.Title); ok {
            if !t.IsTriggerDash() {
                documentTitle = t.TitleData.Title
            }
        }
        return node, data, consumed
    },
    ReadIncludeFn: init.ReadInclude,
    Flags:         parserFlags,
}

Then parser the document (d is a []byte containing the document text):

doc := markdown.Parse(d, p)
mparser.AddBibliography(doc)
mparser.AddIndex(doc)

After this doc is ready to be rendered. Create a renderer, with a bunch of options.

opts := html.RendererOptions{
    Comments:       [][]byte{[]byte("//"), []byte("#")}, // used for callouts.
	RenderNodeHook: mhtml.RenderHook,
	Flags:          html.CommonFlags | html.FootnoteNoHRTag | html.FootnoteReturnLinks| html.CompletePage,
	Generator:      `  <meta name="GENERATOR" content="github.com/mmarkdown/mmark Mmark Markdown Processor - mmark.miek.nl`,
}
opts.Title = documentTitle // hack to add-in discovered title

renderer := html.NewRenderer(opts)

Next we we only need to generate the HTML: x := markdown.Render(doc, renderer). Now x contains a []byte with the HTML.

Also See

Kramdown-rfc2629 is another tool to process markdown and output XML2RFC XML.

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