Fork of mycomarkup with Mojosa extensions
  • Go 99.1%
  • Makefile 0.9%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
surdeus 9d926f984a perf!: colour a link with a lookup instead of a scan
Colouring a link meant handing back a probe for the caller to run against
every page name in the wiki. The probe short-circuited on a match, but the
caller built a copy of the whole index before running it, per link:

	parser/formatted.go   once per inline link
	blocks/img.go         once per image, over every entry
	blocks/rocket.go      once per launchpad, over every rocket

On a five-thousand-page wiki, a page with two hundred links spent 19 ms of a
21 ms render doing that. The same page now renders in 3.5 ms, and the colouring
is within noise of nothing. A hundred-image gallery went from 16.6 ms to 4.9 ms.

The cheap question was already there: Options.PageExists, which transclusions
have always used, and which is documented now as being asked once per link.

	LocalLink.PageProbe          -> LocalLink.MarkExistingIfItExists
	Link.PageProbe               removed from the interface
	Options.IteratePageNamesWith removed; nothing calls it

The probe type existed for the batch sites, which had no cheap lookup to use.
With one, the batching is a workaround around nothing, and it was the source of
the per-link scan: an interface built for many-at-once questions, asked once per
link by the inline parser.

This changes what the default means. PageExists defaults to true, so a render
that wires neither callback now colours every link as existing, where the old
no-op iterator matched nothing. That is right for a standalone render — no link
drawn as broken — but it is a change, and tools/linkvisitor_test.go now sets
PageExists to false because that is what it expects.

TestColouringCostsOneLookupPerLink counts the calls: fifty links must cause
fifty lookups and no walk of the page list. BenchmarkColouring is flat from 500
pages to 50,000.
2026-10-27 06:25:02 +05:00
blocks perf!: colour a link with a lookup instead of a scan 2026-10-27 06:25:02 +05:00
cmd/mojomarkup refactor!: rename mycomarkup to mojomarkup 2026-10-26 21:24:35 +05:00
genhtml fix: escape authored text wherever it becomes markup 2026-10-27 03:54:42 +05:00
links perf!: colour a link with a lookup instead of a scan 2026-10-27 06:25:02 +05:00
mycocontext refactor!: rename mycomarkup to mojomarkup 2026-10-26 21:24:35 +05:00
options perf!: colour a link with a lookup instead of a scan 2026-10-27 06:25:02 +05:00
parser perf!: colour a link with a lookup instead of a scan 2026-10-27 06:25:02 +05:00
temporary_workaround rebranding. 2026-10-26 20:58:23 +05:00
testdata refactor!: rename mycomarkup to mojomarkup 2026-10-26 21:24:35 +05:00
tools perf!: colour a link with a lookup instead of a scan 2026-10-27 06:25:02 +05:00
util perf: cut allocations in rendering 2026-10-26 21:53:47 +05:00
.gitignore refactor!: rename mycomarkup to mojomarkup 2026-10-26 21:24:35 +05:00
A New Kind of Mojomarkup.md refactor!: rename mycomarkup to mojomarkup 2026-10-26 21:24:35 +05:00
colouring_test.go perf!: colour a link with a lookup instead of a scan 2026-10-27 06:25:02 +05:00
go.mod rebranding. 2026-10-26 20:58:23 +05:00
go.sum Move some stuff, fix the id attr, show an error when transcluding from CLI 2021-05-13 22:57:41 +05:00
injection_test.go perf!: colour a link with a lookup instead of a scan 2026-10-27 06:25:02 +05:00
LICENSE Create LICENSE 2021-05-11 14:40:16 +05:00
Makefile refactor!: rename mycomarkup to mojomarkup 2026-10-26 21:24:35 +05:00
mojomarkup.go refactor!: rename mycomarkup to mojomarkup 2026-10-26 21:24:35 +05:00
race_off_test.go perf: cut allocations in rendering 2026-10-26 21:53:47 +05:00
race_on_test.go perf: cut allocations in rendering 2026-10-26 21:53:47 +05:00
README.md refactor!: rename mycomarkup to mojomarkup 2026-10-26 21:24:35 +05:00
render.go feat: render a document as it is parsed 2026-10-26 22:16:28 +05:00
render_test.go perf: render without materialising the document's lines 2026-10-26 22:02:26 +05:00
stream_test.go perf!: colour a link with a lookup instead of a scan 2026-10-27 06:25:02 +05:00
tag_string_test.go perf: render without materialising the document's lines 2026-10-26 22:02:26 +05:00
Versioning.md refactor!: rename mycomarkup to mojomarkup 2026-10-26 21:24:35 +05:00

Mojomarkup

Mojomarkup is a markup language designed to be used in Mojowiki, a fork of Mycorrhiza Wiki, and in Betula. This project is both a library for these projects and a command-line tool for processing Mojomarkup files in other projects.

See the Mojowiki help page on the markup language itself. The rest of the document provides documentation on the library and the command only.

We track tickets on Codeberg.

Running

Usage of mojomarkup:
  -file-name string
        File with mojomarkup. (default "/dev/stdin")
  -page-name string
        Set page name. Relative links depend on it.

Set the parameters and run the program. The output will be written to stdout. The output is HTML code.

Embedding

Mojomarkup provides an API for Go projects. Consult the docs and Mycorrhiza Wiki source code for inspiration.

When possible, integrate with the library rather than with CLI. Some features such as transclusion are not supported in CLI.

Contributing

We accept patches. Please run go fmt.