Hi list,

I'm looking to implement a consistent syntax for cross-references in KeenWrite and am wondering what you think would make the most sense for translating into ConTeXt commands.

First, some background (the first two give an overview, the others are cross-reference references for various syntaxes):
I'm leaning towards the following syntax:

Markdown Item (table, blockquote, TeX block, figure, code, R chunk, etc.)

: caption text {#type:label}

See [@type:label] for details.

There's a unit test that shows what's currently being generated with a number of examples for images, tables, blockquotes, internationalization, and so on:

https://gitlab.com/DaveJarvis/KeenWrite/-/blob/main/src/test/java/com/keenwrite/processors/markdown/extensions/references/CrossReferencesExtensionTest.java#L51

The code is a work-in-progress; so the tests may have changed depending on if/when you view the Java source code. Presently, the captions produce anchor references, mostly. The following seems easier to typeset using ConTeXt:

<p><span class="caption">Meschiya Lake - Lucky Devil <a data-type="lyrics" name="blues" /></span></p>

This diverges from the HTML specification for tables (table/caption) and figures (figure/figcaption). It would also mean having to write ConTeXt macros that flip the spans and anchors to produce a caption such as:

Lyrics 1.1. Meschiya Lake - Lucky Devil

While there are plenty of ways of presenting captions (e.g., multi-column images with sub-figure numbers) the majority of cross-references are to a single "thing" with a single "caption".

What are your thoughts on this proposal? (Keeping in mind I'm the only person working on KeenWrite and while I'm trying to keep the syntax compatible with pandoc, implementing the full pandoc-crossref syntax is out of scope for me.

Thank you!