GitHub - ArnaudValette/Horn: experiments around parsing org.

2 min read Original article ↗
 [
  HornNode {
    children: [
      HornNode {
        children: [],
        glitterNodes: [
          orgFormat {
            start: 0,
            end: 25,
            text: 'this is a paragraph with ',
            type: 0
          },
          orgFormat {
            start: 25,
            end: 36,
            text: 'italicized',
            type: 16
          },
          orgFormat {
            start: 36,
            end: 60,
            text: ' words and a timestamp ',
            type: 0
          },
          orgDate {
            start: 60,
            end: 76,
            text: '[2023-10-13 Fri]',
            type: 'date',
            year: 2023,
            month: 10,
            day: 13,
            weekday: 'Fri'
          },
          orgFormat { start: 76, end: 77, text: '.', type: 0 }
        ],
        tags: [],
        id: 1,
        level: 0,
        nType: 'paragraph',
        textContent: 'this is a paragraph with /italicized/ words and a timestamp [2023-10-13 Fri].'
      },
      HornNode {
        children: [],
        glitterNodes: [
          orgFormat {
            start: 0,
            end: 26,
            text: "there's a list in Node 1 :",
            type: 0
          }
        ],
        tags: [],
        id: 2,
        level: 0,
        nType: 'paragraph',
        textContent: "there's a list in Node 1 :"
      },
      HornNode {
        children: [],
        glitterNodes: [ orgFormat { start: 0, end: 1, text: 'a', type: 0 } ],
        tags: [],
        id: 3,
        level: 1,
        nType: 'list',
        textContent: 'a'
      },
      HornNode {
        children: [],
        glitterNodes: [ orgFormat { start: 0, end: 1, text: 'b', type: 0 } ],
        tags: [],
        id: 4,
        level: 1,
        nType: 'list',
        textContent: 'b'
      },
      HornNode {
        children: [],
        glitterNodes: [
          orgFormat {
            start: 0,
            end: 15,
            text: 'child of node 1',
            type: 0
          }
        ],
        tags: [],
        id: 5,
        level: 2,
        nType: 'heading',
        textContent: 'child of node 1'
      }
    ],
    glitterNodes: [ orgFormat { start: 0, end: 7, text: 'Node 1', type: 8 } ],
    tags: [],
    id: 0,
    level: 1,
    nType: 'heading',
    textContent: '_Node 1_'
  },
  HornNode {
    children: [
      HornNode {
        children: [],
        glitterNodes: [],
        tags: [],
        id: 7,
        level: 0,
        nType: 'empty',
        textContent: ''
      }
    ],
    glitterNodes: [ orgFormat { start: 0, end: 6, text: 'Node 2', type: 0 } ],
    tags: [],
    id: 6,
    level: 1,
    nType: 'heading',
    textContent: 'Node 2'
  }
]