Skip to content

[TASK] Typed directive values - #1392

Merged
jaapio merged 1 commit into
mainfrom
task/directive-value-type
Oct 6, 2026
Merged

jaapio merged 1 commit into
mainfrom
task/directive-value-type

Conversation

@linawolf

@linawolf linawolf commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

Directives have no way to declare what kind of value they accept:
some take no value at all, some only plain text, a file path or
inline markup. Yet DirectiveRule parses every directive value as
inline markup, regardless of what it means.

This change, the proposal @jaapio asked for, lets a directive declare
its value type with DirectiveValueType: Empty, String, Inline, Integer,
Boolean, Path, Url or Array. Restricting a directive's content type and
allowed parent directives is left for follow-up work.

Options keep their own OptionType: what a directive's value may be and
what an option's value may be can differ, so the two stay separate.

DirectiveRule now checks the value against the declared type,
emitting a warning on mismatch, and parses it as inline markup only
when the type is Inline.

Migrated as examples: HighlightsDirective (Empty), and
SectionauthorDirective and RawDirective (String, not inline markup).

Signed-off-by: linawolf
Assisted-By: Claude Sonnet 5 noreply@anthropic.com
Assisted-By: Claude Opus 5.5 (1M context) noreply@anthropic.com

@linawolf linawolf changed the title [TASK] POC: typed directive values, shared with Option's type [TASK] Typed directive values, shared with Option's type Sep 23, 2026
@linawolf
linawolf force-pushed the task/directive-value-type branch from 782731e to d310d42 Compare September 23, 2026 12:29

@jaapio jaapio left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's better to keep the values of directive and options separated. The values on options can differ from what we allow on directives and visa versa. It's not an issue to have duplication for this matter.

@linawolf
linawolf force-pushed the task/directive-value-type branch 3 times, most recently from 8163ca2 to bcc64df Compare October 5, 2026 15:10
@linawolf
linawolf requested a review from jaapio October 5, 2026 15:44
@linawolf linawolf changed the title [TASK] Typed directive values, shared with Option's type [TASK] Typed directive values Oct 5, 2026
@jaapio
jaapio force-pushed the task/directive-value-type branch from bcc64df to cb640e2 Compare October 6, 2026 19:24
@jaapio
jaapio enabled auto-merge October 6, 2026 19:24
Directives have no way to declare what kind of value they accept:
some take no value at all, some only plain text, a file path or
inline markup. Yet DirectiveRule parses every directive value as
inline markup, regardless of what it means.

This change, the proposal @jaapio asked for, lets a directive declare
its value type with DirectiveValueType: Empty, String, Inline, Integer,
Boolean, Path, Url or Array. Restricting a directive's content type and
allowed parent directives is left for follow-up work.

Options keep their own OptionType: what a directive's value may be and
what an option's value may be can differ, so the two stay separate.

DirectiveRule now checks the value against the declared type,
emitting a warning on mismatch, and parses it as inline markup only
when the type is Inline.

Migrated as examples: HighlightsDirective (Empty), and
SectionauthorDirective and RawDirective (String, not inline markup).

Signed-off-by: linawolf
Assisted-By: Claude Sonnet 5 <noreply@anthropic.com>
Assisted-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@jaapio
jaapio force-pushed the task/directive-value-type branch from cb640e2 to 9011d77 Compare October 6, 2026 20:07
@jaapio
jaapio merged commit b3a8332 into main Oct 6, 2026
57 checks passed
@jaapio
jaapio deleted the task/directive-value-type branch October 6, 2026 20:11
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.

2 participants