New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

somehow-script

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

somehow-script

somehow-script demo <a href="https:

latest
npmnpm
Version
1.1.0
Version published
Maintainers
1
Created
Source
somehow-script
demo

this is a work-in-progress markup format for creating metadata in text.

It is inspired by a good number of similar projects:

  • pugjs - period-based control-chars
  • margin - flexible use of [ ] chars
  • archieml - interchangable = and :
  • TOML - typing of booleans+dates
  • literate coffeescript - encourage freehand text

Usage

npm i somehow-script

const smh = require('./src')

let text = `in the town where I was born
there lived a man, who sailed the seas.

the simplest tag is a word that begins with a period:
.film

square-brackets allow adding key-value data to the tag
.film[name: Interview with a Vampire]

somehow-script automatically parses dates+times
.film[release=July 1992]

can add multiple properties at once
.film[release=July 1992, budget=12m]

automatically parses lists
.film[actors=Brad Pitt, Tom Cruise]
`
console.log(smh(text))
/*
{
  data: [
    { name: 'film', props: {}, text: '.film', offset: 124, len: 5 },
    {
      name: 'film',
      props: { name: 'Interview with a Vampire' },
      text: '.film[name: Interview with a Vampire]',
      offset: 186,
      len: 37
    },
    ...
  ]
}
*/

// remove all annotations
console.log(smh.strip(text))
// wrap annotations in generic span tags
console.log(smh.html(text))

Goals

  • create folk-style triplets (without being too-semantic-web)
  • rarely collide with natural text (few false positives)
    • avoid collisions with markdown.
    • avoid collisions with hashtags/atmentions/email/emoticons
  • easy creation on mobile keyboards
  • allow chaining
  • support parsing of natural-language dates (via spacetime)
  • parsing of natural-language numbers (via compromise-tokenize, compromise-numbers)
  • wysiwyg via code/prose-mirror

MIT

FAQs

Package last updated on 13 Dec 2020

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