Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

simplenote-grammar-pegjs

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simplenote-grammar-pegjs

A grammar and peg.js-based parser for Simplenote notes

  • 0.1.17
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
increased by200%
Maintainers
1
Weekly downloads
 
Created
Source

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

Keywords

FAQs

Package last updated on 31 Oct 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc