Skip to content

Add direct sub-example ID references#30

Open
fmatter wants to merge 2 commits intocysouw:mainfrom
fmatter:subex
Open

Add direct sub-example ID references#30
fmatter wants to merge 2 commits intocysouw:mainfrom
fmatter:subex

Conversation

@fmatter
Copy link
Copy Markdown
Contributor

@fmatter fmatter commented Apr 10, 2026

This PR adds the ability to assign custom IDs to individual sub-examples and reference them directly, without manually specifying the letter suffix.

Syntax

Place {#id} in the header line of an interlinear example:

::: {#ex:example1 .ex}
a.
| {#ex:dutch} Dutch (Germanic)
| Deze zin is in het nederlands.
| DEM sentence AUX in DET dutch.
| This sentence is dutch.

b.
| {#ex:mapudungun} Mapudungun (Isolate)
| küpatueyew chi ḻuan
| come-APPL-INV-IND-3-3ACT DEF guanaco
| 'The guanaco came to him.'
:::

The ID marker is removed from the output, leaving clean language headers.

References

Direct references to sub-examples:

  • [@ex:dutch] → (1a)
  • [@ex:mapudungun] → (1b)

The reference format uses no space between the number and letter, matching the parent example's automatic numbering.

Backwards compatibility

The old manual suffix syntax continues to work:

  • [@ex:example1 a] → (1 a)
  • [@last b] → (1 b)

Both methods can coexist in the same document.

Benefits

  • Stable references: Sub-example IDs don't break when reordering
  • Empty headers: Works with | {#id} for language-consistent examples
  • HTML anchors: Custom IDs are available as direct links in HTML output

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant