blob: 0151ba005afb1be241e3554bf442ea682162b2d6 [file] [log] [blame]
// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import '../../markdown.dart';
import '../charcode.dart';
/// Leave inline HTML tags alone, from
/// [CommonMark 0.28](http://spec.commonmark.org/0.28/#raw-html).
///
/// This is not actually a good definition (nor CommonMark's) of an HTML tag,
/// but it is fast. It will leave text like `<a href='hi">` alone, which is
/// incorrect.
///
/// TODO(srawlins): improve accuracy while ensuring performance, once
/// Markdown benchmarking is more mature.
class InlineHtmlSyntax extends TextSyntax {
InlineHtmlSyntax()
: super(
r'<[/!?]?[A-Za-z][A-Za-z0-9-]*(?:\s[^>]*)?>',
startCharacter: $lt,
);
}