luarocks / luarocks/luarocks-site

Migrate from markdown executable to cmark Lua module

Open
#236 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
MoonScript
Stars
201
Forks
50
PR merge metrics
No merged PRs in 30d

Description

## Summary

Replace the external `markdown` executable (discount 3.0.0d) with the [`cmark` Lua module](https://luarocks.org/modules/jgm/cmark) to reduce external dependencies.

## Current Implementation

The codebase currently uses a build-time approach:

1. **Build rule** (`static/md/Tupfile`):
```
: foreach *.md |> markdown < %f > %o |> %B.html
```

2. **Markdown files** in `static/md/`:
- `home.md`
- `about.md`
- `changes.md`
- `intro.md`
- `security_incident_march_2019.md`

3. **Views** include pre-compiled HTML via `raw_ssi` helper in `widgets/helpers.moon`

## Plan

### Files to Modify

1. **`luarocks-site-dev-1.rockspec`** - Add cmark dependency
2. **`cmd/render_markdown.moon`** - New script to render markdown using cmark module
3. **`static/md/Tupfile`** - Update build rule to use new script

## Benefits

- Removes dependency on external `markdown` executable
- Uses a Lua module that can be managed via LuaRocks
- `cmark` is the reference implementation for CommonMark, well-maintained by jgm

## Tasks

- [ ] Add `cmark` to dependencies in rockspec
- [ ] Create `cmd/render_markdown.moon` script using cmark module
- [ ] Update `static/md/Tupfile` to use new script
- [ ] Test all pages that render markdown content

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with luarocks-site-dev-1.rockspec, cmd/render_markdown.moon, and static/md/Tupfile; compare the existing build rule with the planned cmark-based renderer. Rebuild the five files in static/md/ and check the generated pages, with completion meaning cmark is managed through LuaRocks and the pages render without the external markdown executable.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua
Domain
build-system
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.