Skip to content

Commit 46ca986

Browse files
committed
Make section header optional, use key as fallback
When header field is omitted, the section key is used as the header text. This reduces verbosity for common cases: @ sections.Introduction { body = ... } @ sections."*euremark* について" { ... } // with markdown formatting Explicit header still supported when key differs from display text: @ sections.syntax { header = markdown`Syntax Overview` }
1 parent bcbe927 commit 46ca986

File tree

2 files changed

+20
-16
lines changed

2 files changed

+20
-16
lines changed

assets/examples/example.eumd

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,16 @@ cites = ```bibtex
4545
content = markdown`See the [CommonMark Spec](https://commonmark.org) for details.`
4646
}
4747

48-
@ sections.intro {
49-
header = markdown`Introduction`
48+
// Section key as header (no explicit header field needed)
49+
@ sections.Introduction {
5050
body = ```markdown
5151
Traditional Markdown documents have **implicit structure** based on heading levels.
5252
This can lead to ambiguity and makes programmatic manipulation difficult.
5353

5454
Eure-mark addresses this by making the section hierarchy **explicit**!footnote[impl-detail].
5555
```
5656

57-
@ sections.motivation {
58-
header = markdown`Motivation`
57+
@ sections.Motivation {
5958
body = ```markdown
6059
The key motivations for eure-mark are:
6160

@@ -66,8 +65,8 @@ cites = ```bibtex
6665
```
6766
}
6867

69-
@ sections.goals {
70-
header = markdown`Design Goals`
68+
// Quoted key for markdown formatting in header
69+
@ sections."Design *Goals*" {
7170
body = ```markdown
7271
1. Maintain Markdown familiarity for content
7372
2. Add structure where Markdown is weak
@@ -77,14 +76,14 @@ cites = ```bibtex
7776
}
7877
}
7978

79+
// Explicit header when key differs from display text
8080
@ sections.syntax {
8181
header = markdown`Syntax Overview`
8282
body = ```markdown
8383
Eure-mark uses Eure syntax for structure and Markdown for content.
8484
```
8585

86-
@ sections.inline {
87-
header = markdown`Inline Markdown`
86+
@ sections."Inline Markdown" {
8887
body = ````markdown
8988
For short text like headers, use inline code with `markdown` tag:
9089

@@ -96,8 +95,7 @@ cites = ```bibtex
9695
````
9796
}
9897

99-
@ sections.block {
100-
header = markdown`Block Markdown`
98+
@ sections."Block Markdown" {
10199
body = ````markdown
102100
For longer content, use fenced code blocks:
103101

@@ -113,8 +111,7 @@ cites = ```bibtex
113111
}
114112
}
115113

116-
@ sections.references {
117-
header = markdown`References`
114+
@ sections.References {
118115
body = ```markdown
119116
This format was inspired by literate programming!cite[knuth1984] and
120117
the LaTeX document preparation system!cite[lamport1994].

assets/schemas/eure-md.schema.eure

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,14 @@
99
/// - Integrated footnotes and citations (BibTeX)
1010
/// - Markdown content in code blocks
1111
///
12-
/// Section references:
13-
/// - Sections use map structure with ID as key: @ sections.intro { ... }
14-
/// - Reference in markdown: !ref[intro]
12+
/// Section keys as headers:
13+
/// - Section key is used as header if `header` field is omitted
14+
/// - @ sections.Introduction { body = ... } → header is "Introduction"
15+
/// - @ sections."*euremark* について" { ... } → header with markdown formatting
16+
/// - @ sections.intro { header = markdown`Custom Header` } → explicit header
17+
///
18+
/// References:
19+
/// - Reference sections in markdown: !ref[intro]
1520
/// - Nested sections: @ sections.intro.sections.subsection { ... }
1621

1722
$schema = "eure-schema.schema.eure"
@@ -123,9 +128,11 @@ sections.$binding-style = "section"
123128
}
124129

125130
/// Section structure (recursive, map-based for referencing)
131+
/// If header is omitted, the section key is used as the header text.
126132
@ $types.section {
127-
// Section header (inline markdown)
133+
// Section header (inline markdown). If omitted, section key is used as header.
128134
header = `$types.inline-markdown`
135+
header.$optional = true
129136

130137
// Section body content (block markdown)
131138
body = `$types.block-markdown`

0 commit comments

Comments
 (0)