- Go 99.1%
- Makefile 0.9%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
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. |
||
| blocks | ||
| cmd/mojomarkup | ||
| genhtml | ||
| links | ||
| mycocontext | ||
| options | ||
| parser | ||
| temporary_workaround | ||
| testdata | ||
| tools | ||
| util | ||
| .gitignore | ||
| A New Kind of Mojomarkup.md | ||
| colouring_test.go | ||
| go.mod | ||
| go.sum | ||
| injection_test.go | ||
| LICENSE | ||
| Makefile | ||
| mojomarkup.go | ||
| race_off_test.go | ||
| race_on_test.go | ||
| README.md | ||
| render.go | ||
| render_test.go | ||
| stream_test.go | ||
| tag_string_test.go | ||
| Versioning.md | ||
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.