seikichi / restructured

Pure JavaScript reStructuredText parser
58 stars 15 forks source link

Directives need to distinguish between arguments, options, and content #11

Open flying-sheep opened 5 years ago

flying-sheep commented 5 years ago

The directive block is separated from the rest by a blank line, but the parser simply outputs text nodes ignoring blank lines.

e.g. the following rST…

.. figure:: larch.png
   :scale: 50

   The larch.

parses to

{
  "type": "document",
  "children": [
    {
      "type": "directive",
      "directive": "figure",
      "children": [
        {
          "type": "text",
          "value": "larch.png"
        },
        {
          "type": "text",
          "value": ":scale: 50"
        },
        {
          "type": "text",
          "value": "The larch."
        }
      ]
    }
  ]
}