0.0.5 • Published 7 months ago

slashdown v0.0.5

Weekly downloads
14
License
MIT
Repository
-
Last release
7 months ago

SlashDown

For when MDX is too much, but Markdown is too little.

Basic Usage

$ npm install slashdown

import { createSlashdown } from 'slashdown';

const sd = createSlashdown();
const markup = sd`
  /header.flex.justify-between
    # Slashdown
    [Get it](#)

  /ul .grid.grid-cols-3

    /li
      ### Easy to read
      - lots of space

    /li
      ### Fast to write
      - type, type, type

    /li
      ### You already know it
      - Just markdown with extra oomph
`

Alternate renderers

While the default is HTML, Slashdown also ships with a JSON renderer that simply serializes the AST.

import { createSlashdown, JSONRenderer } from 'slashdown';
const sd = createSlashdown({ renderer: JSONRenderer });

sd`/h1 = Hello World`
/* Returns:
  [{
    "type": "Tag",
    "tagName": "h1",
    "children": [
      {
        "type": "Text",
        "content": "Hello World"
      }
    ]
  }]
*/

Writing your own renderer

You can easily write your own renderer by implmenting the SD.Renderer type (a class that has a render method, accepting an AST and returning a string).

Note that Slashdown considers consecutive Markdown to be a single node, and leaves markdown processing entirely up to the renderer.


Known issues

  • Ids/class shorthand conflict with id / class attributes.
  • Codefences not yet supported properly.

Future

  • Conformance to the Unist specification
  • Renderers for popular component frameworks, eg Svelte
0.0.1

7 months ago

0.0.3

7 months ago

0.0.2

7 months ago

0.0.5

7 months ago

0.0.4

7 months ago

1.0.0

3 years ago

0.3.0

3 years ago

0.3.2

3 years ago

0.3.1

3 years ago

0.1.2

3 years ago

0.2.0

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago