package quill

  1. Overview
  2. Docs
Interactive REPL and markdown notebooks

Install

dune-project
 Dependency

Authors

Maintainers

Sources

raven-1.0.0.alpha3.tbz
sha256=96d35ce03dfbebd2313657273e24c2e2d20f9e6c7825b8518b69bd1d6ed5870f
sha512=90c5053731d4108f37c19430e45456063e872b04b8a1bbad064c356e1b18e69222de8bfcf4ec14757e71f18164ec6e4630ba770dbcb1291665de5418827d1465

doc/quill.markdown/Quill_markdown/Edit/index.html

Module Quill_markdown.EditSource

Typora-style cursor-aware markdown block segmentation.

Parses a markdown source string into top-level blocks with byte ranges. Consumers use this to render inactive blocks formatted and the active block (containing the cursor) as raw text for editing.

Types

Sourcetype span = {
  1. first : int;
    (*

    Inclusive start byte offset in source (zero-based).

    *)
  2. last : int;
    (*

    Inclusive end byte offset in source (zero-based).

    *)
}

A byte range within the source string.

Sourcetype block_kind =
  1. | Paragraph
  2. | Heading of int
  3. | Block_quote
  4. | List
  5. | Thematic_break
  6. | Table
  7. | Blank
    (*

    The kind of a top-level markdown block.

    *)
Sourcetype block = {
  1. span : span;
  2. kind : block_kind;
}

A top-level block extracted from a markdown source string.

Sourcetype t

A parsed markdown source split into blocks with byte ranges.

Parsing

Sourceval parse : string -> t

parse source parses source into blocks with byte ranges.

Sourceval source : t -> string

source t is the original source string.

Sourceval blocks : t -> block list

blocks t is the list of top-level blocks in document order.

Queries

Sourceval active_block : t -> cursor:int -> block option

active_block t ~cursor is the block containing byte offset cursor, or None if cursor is outside all blocks.

Sourceval block_source : t -> block -> string

block_source t block extracts the raw source substring for block.

Rendering

Sourceval block_to_html : t -> block -> string

block_to_html t block renders block to an HTML fragment.

Sourceval to_html : string -> string

to_html source renders CommonMark source to an HTML fragment.