npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

smh-parser

v1.0.2

Published

Simple Markup language for Humans

Downloads

4

Readme

SMH SPEC v1.0

Simple Markup language for Humans and isaac

Introduction

smh is a markup language that's designed to have the readability of yaml with the simplicity of json.

"So simple, you can write your own parser"

There are three types:

  • String

    The only escapes that are guaranteed to be recognized by the parser are \", \\, and \n

    Literal newline characters are only included in strings when using double quotes

    this is a string
    "this is a string"
    1.0.0
    3.14159
    123456789
  • Array

    [this, is, an, array]
      
    - this
    - is
    - an
    - array
  • Object

    author: Chinua Achebe
    country: Nigeria
    image link: images/things-fall-apart.jpg
    language: English
    link: https://en.wikipedia.org/wiki/Things_Fall_Apart
    pages: 209
    title: Things Fall Apart
    year: 1958

Usage:

import { smh, Failure } from 'smh-parser';

let content = smh(`
  - this
  - is
  - an
  - array
`);

if(content instanceof Failure){
    console.log("ERROR - " + content.toString());
} else {
    console.log(content);
}

Examples:

- name: Isaac Shelton
  age: 100
  phone number: (123) 456-789
  email: [email protected]
- name: Joe Gow
  age: 758
  phone number: (321) 654-987
  email: [email protected]
red: #FF0000
green: #00FF00
blue: #0000FF
cyan: #00FFFF
magenta: #FF00FF
yellow: #FFFF00
id: 0001
type: donut
name: Cake
ppu: 0.55
image:
  url: images/0001.jpg
  width: 200
  height: 200
thumbnail:
  url: images/thumbnails/0001.jpg
  width: 32
  height: 32
- id: 1
  first name: Tiffanie
  last name: Bonhan
  email: [email protected]
  ip address: 27.189.213.24
- id: 2
  first name: Marielle
  last name: Scala
  email: [email protected]
  ip address: 232.18.211.108
- id: 3
  first name: Wheeler
  last name: Douce
  email: [email protected]
  ip address: 194.87.70.152
- id: 4
  first name: Benedicta
  last name: Pitcher
  email: [email protected]
  ip address: 121.106.70.157
- id: 5
  first name: Kasey
  last name: Gutherson
  email: [email protected]
  ip address: 32.37.84.111
title: delectus aut autem
user id: fa98b8ec-09d1648a-8f69420b-4b9e8eac
draft: false
pages: 5

Conventions

There are no true, false, or null, but your code may use strings to represent them.

When this is the case, it's convention to use:

  • true/"true" for true
  • false/"false" for false
  • null/"null" for null

Why not use X instead?

Why not just use YAML?

  • YAML has a ton of unnecessary "features"
  • Way more convoluted than it should be
  • Virtually none of the parsers implement the entire spec
  • Behaves in suprising, inconsistent, and unexpected ways

Why not just JSON?

  • Not as human readable
  • Lots of extra characters which make it harder to manipulate quickly

Why not just use TOML?

  • It's not as flexible
  • It's not as human readable

Why not just use XML?

  • It's incredibly verbose and repeats itself
  • Ugly and not very human readable

Why SMH?

  • So simple, you can even write your own parser
  • Human readable
  • No ambiguity