Skip to content

nbbaier/tana-to-json

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tana-to-json

This package provides a function to parse Tana Paste format to JSON.

Install:

npm install tana-to-json

Usage

import { tanaToJson } from "./src/index";

const tanaPaste = `
- Hello world #test
  - foo:: bar
  - a non-field child`;

const json = tanaToJson(tanaPaste);

The output of the above will be the following object:

[
  {
    "name": "Hello world #test",
    "tags": [
      "test"
    ],
    "type": "node",
    "children": [
      {
        "name": "foo",
        "type": "field",
        "children": [
          {
            "name": "bar",
            "type": "node"
          }
        ]
      },
      {
        "name": "a non-field child",
        
        "type": "node"
      }
    ]
  }
]

Acknowledgements

The code here was adapted from Brett Adam's great tana-helper suite of tools.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published