0.1.17 • Published 8 years ago

simplenote-grammar-pegjs v0.1.17

Weekly downloads
23
License
GPL-3.0
Repository
github
Last release
8 years ago

Simplenote Note Grammar and Parser

This library provides a grammar defining what kinds of content can be represented inside a Simplenote note. Simplenote notes are plain-text documents but the text can represent structured information such as URLs and Markdown.

This parser's goal is to identify such data and provide a structured output suitable for syntax highlighting/formatting and introspection.

Please note that this is still experimental and in its infancy. Please do not rely on this or expect it to be production-ready.

import { parse as noteParser } from 'simplenote-grammar-pegjs'

function parseNote( note, parser ) {
    try {
        return parser( note )
    } catch (e) {
        return e
    }
}

const parsedNote = parseNote( 'Just some text', noteParser )
if ( parsedNote instanceof Error ) {
    abort()
}

parsedNote // === [ { type: 'text', text: 'Just some text', location: [ 0, 14 ] } ]
0.1.17

8 years ago

0.1.16

8 years ago

0.1.15

8 years ago

0.1.14

8 years ago

0.1.13

8 years ago

0.1.12

8 years ago

0.1.11

8 years ago

0.1.10

8 years ago

0.1.9

8 years ago

0.1.8

8 years ago

0.1.7

8 years ago

0.1.6

8 years ago

0.1.5

8 years ago

0.1.4

8 years ago

0.1.3

8 years ago

0.1.2

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago