Parser

zio.blocks.docs.Parser
object Parser

Parser for GitHub Flavored Markdown.

Provides strict parsing of GFM documents, returning either a parsed Doc or a ParseError with position information.

==Supported Features==

  • ATX headings (# to ######)
  • Fenced code blocks (
 - Thematic breaks (---, ***, ___)
 - Block quotes (> prefix)
 - Bullet and ordered lists
 - Task lists (- [ ] and - [x])
 - Tables with alignment
 - Inline formatting (emphasis, strong, strikethrough, code)
 - Links and images
 - Autolinks
 - HTML blocks and inline HTML

==Not Supported==
 - YAML frontmatter (causes parse error)
 - Setext headings (use ATX style)
 - Indented code blocks (use fenced)
 - Link reference definitions

Attributes

Source
Parser.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Parser.type

Members list

Value members

Concrete methods

def parse(input: String): Either[ParseError, Doc]

Parses a markdown string into a Doc.

Parses a markdown string into a Doc.

Value parameters

input

The markdown string to parse

Attributes

Returns

Either a ParseError with position info, or the parsed Doc

Example
 Parser.parse("# Hello") match { case Right(doc) => println(s"Parsed
 $${doc.blocks.size} blocks") case Left(err) => println(s"Error at line
 $${err.line}: $${err.message}") } 
Source
Parser.scala