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 | |
| parent | line comments (diff) | |
| download | alive-a668ad6c7523c010b129d9c21fdf90830bcbf77b.tar.gz alive-a668ad6c7523c010b129d9c21fdf90830bcbf77b.zip | |
use cmark instead of discount for markdown docs
| -rw-r--r-- | Dockerfile | 12 | ||||
| -rw-r--r-- | README.md | 12 | ||||
| -rw-r--r-- | alv/config.ld | 2 | ||||
| -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 | ||||
| -rw-r--r-- | flake.nix | 27 |
9 files changed, 28 insertions, 57 deletions
@@ -1,12 +1,10 @@ -FROM nickblah/lua:5.3-luarocks AS build-env +FROM nickblah/lua:5.4-luarocks-alpine AS build-env WORKDIR /build -RUN apt-get update && \ - apt-get install -y --allow-unauthenticated \ - build-essential m4 libmarkdown2-dev git -RUN luarocks install discount DISCOUNT_INCDIR=/usr/include/x86_64-linux-gnu && \ - luarocks install moonscript && \ - luarocks install https://raw.githubusercontent.com/s-ol/LDoc/moonscript/ldoc-scm-2.rockspec +RUN apk add --no-cache build-base git cmark-dev +RUN luarocks install moonscript && \ + luarocks install ldoc && \ + luarocks install cmark COPY . /build/ RUN make docs @@ -14,15 +14,13 @@ processes. For more information, visit the full [online documentation][docs]. - [MoonScript][moonscript]: `luarocks install moonscript` - [luafilesystem][lfs]*: `luarocks install luafilesystem` - [LPeg][lpeg]*: `luarocks install lpeg` -- [socket][socket]: `luarocks install luasocket` - [system][system]: `luarocks install luasystem` +- [socket][socket]: `luarocks install luasocket` (optional) - [losc][losc]: `luarocks install losc` (optional) - [lua-rtmidi][rtmidi]: `luarocks install lua-rtmidi` (optional) - [busted][busted]: `luarocks install busted` (optional, for tests) -- [discount][discount]: `luarocks install discount` (optional, for docs) -- [ldoc][ldoc]: `luarocks install - https://raw.githubusercontent.com/s-ol/LDoc/moonscript/ldoc-scm-2.rockspec` - (optional, for docs) +- [ldoc][ldoc]: `luarocks install ldoc` (optional, for docs) +- [cmark][cmark]: `luarocks install cmark` (optional, for docs) \* these are also `moonscript` dependencies and do not neet to be installed manually. @@ -65,8 +63,8 @@ development, simply pass the files as arguments: [socket]: http://w3.impa.br/~diego/software/luasocket/ [rtmidi]: https://github.com/s-ol/lua-rtmidi/ [busted]: https://olivinelabs.com/busted/ -[discount]: https://luarocks.org/modules/craigb/discount -[ldoc]: https://github.com/s-ol/LDoc +[ldoc]: https://github.com/lunarmodules/ldoc +[cmark]: https://github.com/jgm/cmark-lua [love]: https://love2d.org/ [docs]: https://alv.s-ol.nu diff --git a/alv/config.ld b/alv/config.ld index 56207b9..2a0940b 100644 --- a/alv/config.ld +++ b/alv/config.ld @@ -9,7 +9,7 @@ improve or extend alive with new modules, language or interpreter features. If you are looking for the language reference for users, head over to the [reference](../reference/index.html) section of the documentation.]] -format = 'discount' +format = 'commonmark' style = nil template = 'docs' dir = 'docs/internals' 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; } @@ -100,32 +100,6 @@ }; }; - discount = luaPkgs.buildLuarocksPackage { - pname = "discount"; - version = "0.4-1"; - - knownRockspec = - (pkgs.fetchurl { - url = mirror://luarocks/discount-0.4-1.rockspec; - hash = "sha256-7bIW6KKFNPGNiVB3m1DasIPI8znq7ZC2iBS5fCevglU="; - }) - .outPath; - - src = pkgs.fetchurl { - url = https://craigbarnes.gitlab.io/dist/lua-discount/lua-discount-0.4.tar.gz; - hash = "sha256-NTHu3d5KidW3pKubNZp/AaiKyF3U+sYVVOsZkWXP3q0="; - }; - - buildInputs = [pkgs.discount]; - propagatedBuildInputs = [luaPkgs.lua]; - - meta = { - homepage = "https://github.com/craigbarnes/lua-discount"; - description = "Lua bindings for the Discount Markdown library"; - license = lib.licenses.isc; - }; - }; - ldoc = luaPkgs.buildLuarocksPackage rec { pname = "ldoc"; version = "scm-2"; @@ -191,7 +165,6 @@ fltk4lua losc busted - discount lua-rtmidi ] ++ ( |
