aboutsummaryrefslogtreecommitdiffstats
path: root/docs/gen/md
blob: 32d4fddfacf02ab44824e392d4a940f4ca1a5591 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/env moon
import layout, autoref from require 'docs.gen.layout'
import compile from require 'discount'

export OUT, ESCAPE

slurp = (file) ->
  file = io.open file, 'r'
  with file\read '*all'
    file\close!

spit = (file, str) ->
  file = io.open file, 'w'
  file\write str
  file\close!

ESCAPE = (str) ->
  (str\gsub '([*`])', '\\%1')

{ OUT, file } = arg

contents = slurp file
spit OUT, layout compile (autoref contents), 'githubtags', 'fencedcode'