InlineMd class abstract
Inline component of the legacy regex pipeline.
A subclass is reachable only through inlineComponents, which selects the
legacy pipeline: the document is rendered as one text tree, with no
incremental segment cache, no span-level streaming reveal and no lazy
sliver, so a streaming reply re-parses and re-lays-out the whole message on
every append. Use InlinePattern for host syntax that is still text, or
InlineDirective for a delimited payload the parser must not read; both
work on either pipeline.
Before:
class ShoutMd extends InlineMd {
@override
RegExp get exp => RegExp(r'!![A-Za-z]+!!');
@override
InlineSpan span(
BuildContext context,
String text,
GptMarkdownConfig config,
) {
return TextSpan(
text: text.replaceAll('!!', '').toUpperCase(),
style: config.style?.copyWith(fontWeight: FontWeight.bold),
);
}
}
GptMarkdown(
text,
inlineComponents: [ShoutMd(), ...MarkdownComponent.inlineComponents],
)
After:
GptMarkdown(
text,
inlinePatterns: [
InlinePattern(
pattern: RegExp(r'!![A-Za-z]+!!'),
builder: (context, match, style) => TextSpan(
text: match[0]!.replaceAll('!!', '').toUpperCase(),
style: style.copyWith(fontWeight: FontWeight.bold),
),
),
],
)
- Inheritance
-
- Object
- MarkdownComponent
- InlineMd
- Implementers
- Annotations
-
- @Deprecated('Use InlinePattern, or InlineDirective for a delimited payload. ' 'Will be removed in 2.0.0.')
Constructors
- InlineMd()
Properties
- exp → RegExp
-
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- inline → bool
-
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
scopes
→ Set<
MarkdownScope> -
The nesting contexts this component is allowed to render in.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
span(
BuildContext context, String text, GptMarkdownConfig config) → InlineSpan -
override
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited