Some checks are pending
CI / Format · Analyze · Test (push) Waiting to run
Markdown mode now validates deck structure before apply, highlights issues by line, and allows proceeding after a warning. Dual-screen exit closes the audience window once and avoids Linux embedder crashes from duplicate teardown. Co-authored-by: Cursor <cursoragent@cursor.com>
36 lines
865 B
Dart
36 lines
865 B
Dart
enum MarkdownValidationSeverity { error, warning }
|
|
|
|
class MarkdownValidationIssue {
|
|
final int line;
|
|
final MarkdownValidationSeverity severity;
|
|
final String message;
|
|
|
|
const MarkdownValidationIssue({
|
|
required this.line,
|
|
required this.severity,
|
|
required this.message,
|
|
});
|
|
|
|
@override
|
|
String toString() => 'L$line: $message';
|
|
}
|
|
|
|
class MarkdownValidationResult {
|
|
final List<MarkdownValidationIssue> issues;
|
|
|
|
const MarkdownValidationResult(this.issues);
|
|
|
|
bool get isValid => !issues.any(
|
|
(issue) => issue.severity == MarkdownValidationSeverity.error,
|
|
);
|
|
|
|
bool get hasIssues => issues.isNotEmpty;
|
|
|
|
int get errorCount => issues
|
|
.where((i) => i.severity == MarkdownValidationSeverity.error)
|
|
.length;
|
|
|
|
int get warningCount => issues
|
|
.where((i) => i.severity == MarkdownValidationSeverity.warning)
|
|
.length;
|
|
}
|