How to use the orga.Parser function in orga

To help you get started, we’ve selected a few orga examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github orgapp / orgajs / www / src / pages / ast.jsx View on Github external
render() {
    const d = this.props.data.astToml
    const parser = new Parser()
    const replacer = (key, value) => {
      if ([`parent`].includes(key)) return
      if (Array.isArray(value) && value.length === 0) return
      return value
    }
    const examples = d.examples.map(e => {
      const obj = parser.parse(e.org)
      const json = JSON.stringify(obj.children[0], replacer, 2)
      console.log(json)
      return (
        <div>
          <h2>{ e.name }</h2>
          <p>{ e.desc }</p>
          <pre><code>{ e.org }</code></pre>
          <p>Yields:</p>
          <pre><code>{ json }</code></pre></div>
github orgapp / orgajs / packages / orga-unified / src / index.ts View on Github external
function Parser(doc, file) {
  this.file = file
  this._parser = new OrgaParser()
}
github orgapp / orgajs / packages / gatsby-transformer-orga / src / orga-util.ts View on Github external
return new Promise(resolve => {
    const parser = new Parser()
    const ast = parser.parse(node.internal.content)
    resolve(ast)
  })
}
github orgapp / orgajs / www / src / pages / ast.js View on Github external
render() {
    const d = this.props.data.astToml
    const parser = new Parser()
    const replacer = (key, value) =&gt; {
      if ([`parent`].includes(key)) return
      if (Array.isArray(value) &amp;&amp; value.length === 0) return
      return value
    }
    const examples = d.examples.map((e, i) =&gt; {
      const obj = parser.parse(e.org)
      const json = JSON.stringify(obj.children[0], replacer, 2)
      return (
        <div>
          <h2>{ e.name }</h2>
          <p>{ e.desc }</p>
          <pre><code>{ e.org }</code></pre>
          <p>Yields:</p>
          <pre><code>{ json }</code></pre>
        </div>

orga

org-mode parser

MIT
Latest version published 9 months ago

Package Health Score

61 / 100
Full package analysis