Giter VIP home page Giter VIP logo

afm's Introduction

NPM Version

Astro Flavored Markdown

This is a command-line tool to render Astro Flavored Markdown documents to JSON abstract syntax trees or HTML. Astro Flavored Markdown is a dialect of Markdown for rapid astronomy communications. Astro Flavored Markdown detects and enriches dates, times, sky coordinates, and bibliographic references in text.

This command-line interface is a thin wrapper around remark-rehype-astro, the reference implementation of Astro Flavored Markdown as a plugin for the Unified parser ecosystem.

Usage

Usage: afm [options] [input]

Render Astro Flavored Markdown as a JSON syntax tree or as HTML

Arguments:
  input                  input file [default: stdin]

Options:
  --html                 output is in HTML [default: output is in JSON]
  -o, --output <output>  output file [default: stdout]
  -h, --help             display help for command

Example

Place the following text into a file called example.md:

# Example

Here is a table:

| Transient | Classification |
| --------- | -------------- |
| AT2017gfo | kilonova       |

To render as a JSON syntax tree:

$ npx @nasa-gcn/afm example.md
{
  "type": "root",
  "children": [
    {
      "type": "heading",
      "depth": 1,
      "children": [
        {
          "type": "text",
          "value": "Example"
        }
      ]
    },
    {
      "type": "paragraph",
      "children": [
        {
          "type": "text",
          "value": "Here is a table:"
        }
      ]
    },
    {
      "type": "table",
      "align": [
        null,
        null
      ],
      "children": [
        {
          "type": "tableRow",
          "children": [
            {
              "type": "tableCell",
              "children": [
                {
                  "type": "text",
                  "value": "Transient"
                }
              ]
            },
            {
              "type": "tableCell",
              "children": [
                {
                  "type": "text",
                  "value": "Classification"
                }
              ]
            }
          ]
        },
        {
          "type": "tableRow",
          "children": [
            {
              "type": "tableCell",
              "children": [
                {
                  "type": "text",
                  "value": "AT2017gfo",
                  "data": {
                    "class": "tns",
                    "value": "2017gfo"
                  }
                }
              ]
            },
            {
              "type": "tableCell",
              "children": [
                {
                  "type": "text",
                  "value": "kilonova"
                }
              ]
            }
          ]
        }
      ]
    }
  ]
}

To render as HTML:

$ npx @nasa-gcn/afm --html example.md

<h1>Example</h1>
<p>Here is a table:</p>
<table>
  <thead>
    <tr>
      <th>Transient</th>
      <th>Classification</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><data class="tns" value="2017gfo">AT2017gfo</data></td>
      <td>kilonova</td>
    </tr>
  </tbody>
</table>

afm's People

Contributors

dakota002 avatar dependabot[bot] avatar lpsinger avatar

Watchers

 avatar  avatar

Forkers

lpsinger

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.