Skip to content
/ hipt Public

Hipt is a library to parse plain text with indentation.

License

Notifications You must be signed in to change notification settings

k0michi/hipt

Repository files navigation

Hierarchically Indented Plain Text

This is a library to parse plain text with indentation like this:

abc
  def
    ghi
123
  456
    789

Installation

$ npm i hipt
$ yarn add hipt

Usage

import * as hipt from 'hipt';

const root = hipt.parse(
`abc
  def
    ghi
123
  456
    789`
);
/*
{
  "children": [
    {
      "value": "abc",
      "children": [
        {
          "value": "def",
          "children": [
            {
              "value": "ghi",
              "children": []
            }
          ]
        }
      ]
    },
    {
      "value": "123",
      "children": [
        {
          "value": "456",
          "children": [
            {
              "value": "789",
              "children": []
            }
          ]
        }
      ]
    }
  ]
}
*/

License

MIT License

About

Hipt is a library to parse plain text with indentation.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published