Turns org-mode content into AST.
npm install --save orga
const { parse } = require('orga')
const ast = parse(`* TODO remember the milk :shopping:`)
ast
is an object looks like this:
{
type: 'document',
properties: {},
children: [
{
type: 'section',
level: 1,
properties: {},
children: [
{
type: 'headline',
actionable: true,
content: 'remember the milk',
children: [
{
type: 'stars',
level: 1,
position: {
start: { line: 1, column: 1 },
end: { line: 1, column: 2 }
},
parent: [Circular *1]
},
{
type: 'todo',
keyword: 'TODO',
actionable: true,
position: {
start: { line: 1, column: 3 },
end: { line: 1, column: 7 }
},
parent: [Circular *1]
},
{
type: 'text.plain',
value: 'remember the milk',
position: {
start: { line: 1, column: 8 },
end: { line: 1, column: 25 }
},
parent: [Circular *1]
},
{
type: 'tags',
tags: [ 'shopping' ],
position: {
start: { line: 1, column: 29 },
end: { line: 1, column: 39 }
},
parent: [Circular *1]
}
],
level: 1,
position: {
start: { line: 1, column: 1 },
end: { line: 1, column: 39 }
},
keyword: 'TODO',
tags: [ 'shopping' ],
parent: [Circular *2]
}
],
position: { start: { line: 1, column: 1 }, end: { line: 1, column: 39 } },
parent: [Circular *3]
}
],
position: { start: { line: 1, column: 1 }, end: { line: 1, column: 39 } }
}