diff options
| author | s-ol <s+removethis@s-ol.nu> | 2025-06-12 13:29:59 +0000 |
|---|---|---|
| committer | s-ol <s+removethis@s-ol.nu> | 2025-06-12 13:35:43 +0000 |
| commit | a668ad6c7523c010b129d9c21fdf90830bcbf77b (patch) | |
| tree | 2d06e4c429dc12e6577ee01fe992a7f41d2bab8d /docs | |
| parent | line comments (diff) | |
| download | alive-a668ad6c7523c010b129d9c21fdf90830bcbf77b.tar.gz alive-a668ad6c7523c010b129d9c21fdf90830bcbf77b.zip | |
use cmark instead of discount for markdown docs
Diffstat (limited to 'docs')
| -rwxr-xr-x | docs/gen/index | 7 | ||||
| -rw-r--r-- | docs/gen/layout.moon | 9 | ||||
| -rwxr-xr-x | docs/gen/md | 9 | ||||
| -rwxr-xr-x | docs/gen/module | 5 | ||||
| -rw-r--r-- | docs/style.css | 2 |
5 files changed, 17 insertions, 15 deletions
diff --git a/docs/gen/index b/docs/gen/index index 1536645..c2eef6b 100755 --- a/docs/gen/index +++ b/docs/gen/index @@ -1,9 +1,8 @@ #!/usr/bin/env moon require 'alv' -import render, layout, autoref, subnav from require 'docs.gen.layout' +import compile, render, layout, autoref, subnav from require 'docs.gen.layout' import section, h1, h2, p, ul, li, a, code from require 'docs.gen.dom' import get_module from require 'docs.gen.shim' -import compile from require 'discount' export OUT @@ -27,7 +26,7 @@ for file in *arg[3,] summary = if mod.meta then ": #{mod.meta.summary}" else '' md ..= " - [`#{modname}`](module/#{name}.html)#{summary}\n" -content = compile (autoref md), 'githubtags', 'fencedcode' +content = compile autoref md sub = subnav [a for a in *arg[3,]] spit OUT, layout - body: table.concat { sub, content.body }, '\n\n' + body: table.concat { sub, content }, '\n\n' diff --git a/docs/gen/layout.moon b/docs/gen/layout.moon index 895baaa..93a7851 100644 --- a/docs/gen/layout.moon +++ b/docs/gen/layout.moon @@ -1,8 +1,12 @@ version = require 'alv.version' dom = require 'docs.gen.dom' -import compile from require 'discount' +cmark = require 'cmark' import opairs from require 'alv.util' +compile = (md) -> + doc = cmark.parse_string md, cmark.OPT_DEFAULT + cmark.render_html doc, cmark.OPT_DEFAULT + cmark.OPT_UNSAFE + render_meta = (meta) -> import p, code from dom contents = {} @@ -12,7 +16,7 @@ render_meta = (meta) -> table.insert contents, examples if meta.description description = compile meta.description\match '^\n*(.+)\n*$' - table.insert contents, description.body + table.insert contents, description contents @@ -215,6 +219,7 @@ layout = (opts) -> { + :compile :autoref :render :layout diff --git a/docs/gen/md b/docs/gen/md index f22268c..d07ab5f 100755 --- a/docs/gen/md +++ b/docs/gen/md @@ -1,6 +1,5 @@ #!/usr/bin/env moon -import layout, subnav, autoref from require 'docs.gen.layout' -import compile from require 'discount' +import compile, layout, subnav, autoref from require 'docs.gen.layout' export OUT, ESCAPE @@ -18,8 +17,8 @@ ESCAPE = (str) -> (str\gsub '([*`])', '\\%1') { OUT, file } = arg -content = compile (autoref slurp file), 'githubtags', 'fencedcode' +content = compile autoref slurp file if #arg > 2 sub = subnav [a for a in *arg[3,]] - content.body = table.concat { sub, content.body }, '\n\n' -spit OUT, layout content + content = table.concat { sub, content }, '\n\n' +spit OUT, layout body: content diff --git a/docs/gen/module b/docs/gen/module index d7a8e76..4436fe5 100755 --- a/docs/gen/module +++ b/docs/gen/module @@ -1,10 +1,9 @@ #!/usr/bin/env moon import Constant from require 'alv' import opairs from require 'alv.util' -import render, render_meta, layout, autoref, subnav from require 'docs.gen.layout' +import compile, render, render_meta, layout, autoref, subnav from require 'docs.gen.layout' import h2, h3, p, ul, li, code from require 'docs.gen.dom' import get_module from require 'docs.gen.shim' -import compile from require 'discount' export OUT @@ -30,7 +29,7 @@ get_description = (module) -> buf = p m.summary if m.description - buf ..= (compile autoref(m.description), 'nopants').body + buf ..= compile autoref m.description buf diff --git a/docs/style.css b/docs/style.css index a559f28..90123a2 100644 --- a/docs/style.css +++ b/docs/style.css @@ -42,7 +42,7 @@ pre > code { padding: 0.5rem 1rem; background: #cccccc; } -pre > code.output { +pre > code.language-output { background: #222222; color: #cccccc; } |
