diff --git a/CHANGELOG.md b/CHANGELOG.md index a8b61a37..7c6672f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,21 +2,22 @@ * **Breaking change**: `close()` of `DelimiterSyntax` and `LinkSyntax` returns multiple nodes instead of single one. - -## 6.0.2-dev - -* Fix a crash in checkbox lists when mixing checkbox items with - non-checkbox items. -* Add a new syntax `BlockHtmlSyntax` to parse HTML blocks. +* **Breaking change**: Remove deprecated APIs, including `TagSyntax`, + `indicatorForCheckedCheckBox`, and `indicatorForUncheckedCheckBox`. +* **Breaking change**: Removed `BlockHtmlSyntax`, `BlockTagBlockHtmlSyntax`, + `LongBlockHtmlSyntax`, and `OtherTagBlockHtmlSyntax`. +* Add a new syntax `HtmlBlockSyntax` to parse HTML blocks. * Add a new syntax `DecodeHtmlSyntax` to decode HTML entity and numeric character references. * Add a new syntax `SoftLineBreakSyntax` to remove the single space before the line ending. -* Deprecate `BlockTagBlockHtmlSyntax`, `LongBlockHtmlSyntax` and - `OtherTagBlockHtmlSyntax`. These syntaxes will be removed from the next major - version. * Add an option `caseSensitive` to `TextSyntax`. +## 6.0.1 + +* Fix a crash in checkbox lists when mixing checkbox items with + non-checkbox items. + ## 6.0.0 * Require Dart 2.17 diff --git a/lib/markdown.dart b/lib/markdown.dart index 58d0d8ee..62d75768 100644 --- a/lib/markdown.dart +++ b/lib/markdown.dart @@ -38,7 +38,6 @@ import 'src/version.dart'; export 'src/ast.dart'; export 'src/block_parser.dart'; -export 'src/block_syntaxes/block_html_syntax.dart'; export 'src/block_syntaxes/block_syntax.dart'; export 'src/block_syntaxes/blockquote_syntax.dart'; export 'src/block_syntaxes/code_block_syntax.dart'; @@ -68,6 +67,7 @@ export 'src/inline_syntaxes/autolink_extension_syntax.dart'; export 'src/inline_syntaxes/autolink_syntax.dart'; export 'src/inline_syntaxes/code_syntax.dart'; export 'src/inline_syntaxes/color_swatch_syntax.dart'; +export 'src/inline_syntaxes/decode_html_syntax.dart'; export 'src/inline_syntaxes/delimiter_syntax.dart'; export 'src/inline_syntaxes/email_autolink_syntax.dart'; export 'src/inline_syntaxes/emoji_syntax.dart'; @@ -80,7 +80,6 @@ export 'src/inline_syntaxes/line_break_syntax.dart'; export 'src/inline_syntaxes/link_syntax.dart'; export 'src/inline_syntaxes/soft_line_break_syntax.dart'; export 'src/inline_syntaxes/strikethrough_syntax.dart'; -export 'src/inline_syntaxes/tag_syntax.dart'; export 'src/inline_syntaxes/text_syntax.dart'; const version = packageVersion; diff --git a/lib/src/block_syntaxes/block_html_syntax.dart b/lib/src/block_syntaxes/block_html_syntax.dart deleted file mode 100644 index 122c9407..00000000 --- a/lib/src/block_syntaxes/block_html_syntax.dart +++ /dev/null @@ -1,19 +0,0 @@ -// 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 '../block_parser.dart'; -import 'block_syntax.dart'; - -/// Parses inline HTML at the block level. This differs from other Markdown -/// implementations in several ways: -/// -/// 1. This one is way way WAY simpler. -/// 2. Essentially no HTML parsing or validation is done. We're a Markdown -/// parser, not an HTML parser! -abstract class BlockHtmlSyntax extends BlockSyntax { - @override - bool canEndBlock(BlockParser parser) => true; - - const BlockHtmlSyntax(); -} diff --git a/lib/src/block_syntaxes/block_tag_block_html_syntax.dart b/lib/src/block_syntaxes/block_tag_block_html_syntax.dart deleted file mode 100644 index 7e40ac99..00000000 --- a/lib/src/block_syntaxes/block_tag_block_html_syntax.dart +++ /dev/null @@ -1,50 +0,0 @@ -// 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 '../ast.dart'; -import '../block_parser.dart'; -import '../patterns.dart'; -import 'block_html_syntax.dart'; - -@Deprecated('Use HtmlBlockSyntax instead') -class BlockTagBlockHtmlSyntax extends BlockHtmlSyntax { - static final _pattern = RegExp( - '^ {0,3}|/>|$)'); - - /// The [_pattern] regular expression above is very expensive, even on - /// paragraphs of Markdown with no HTML. This regular expression can be used - /// first as a basic check that the input might possibly be an HTML block - /// tag, which occur very rarely in typical Markdown. - static final _openBracketPattern = RegExp('^ {0,3}<'); - - @override - RegExp get pattern => _pattern; - - const BlockTagBlockHtmlSyntax(); - - @override - bool canParse(BlockParser parser) { - if (!_openBracketPattern.hasMatch(parser.current)) return false; - return super.canParse(parser); - } - - @override - Node parse(BlockParser parser) { - final childLines = []; - - // Eat until we hit a blank line. - while (!parser.isDone && !parser.matches(emptyPattern)) { - childLines.add(parser.current); - parser.advance(); - } - - return Text(childLines.join('\n').trimRight()); - } -} diff --git a/lib/src/block_syntaxes/list_syntax.dart b/lib/src/block_syntaxes/list_syntax.dart index 7b6d0b17..4105ec0c 100644 --- a/lib/src/block_syntaxes/list_syntax.dart +++ b/lib/src/block_syntaxes/list_syntax.dart @@ -9,18 +9,6 @@ import 'block_syntax.dart'; import 'ordered_list_with_checkbox_syntax.dart'; import 'unordered_list_with_checkbox_syntax.dart'; -/// As of Markdown 6.0.1 invisible indicators for checked/unchecked checkboxes are -/// no longer used. These constants are now empty strings to reflect that. -@Deprecated( - 'This string is no longer used internally. It will be removed in a future version.') -const indicatorForUncheckedCheckBox = ''; - -/// As of Markdown 6.0.1 invisible indicators for checked/unchecked checkboxes are -/// no longer used. These constants are now empty strings to reflect that. -@Deprecated( - 'This string is no longer used internally. It be will be removed in a future version.') -const indicatorForCheckedCheckBox = ''; - class ListItem { const ListItem( this.lines, { diff --git a/lib/src/block_syntaxes/long_block_html_syntax.dart b/lib/src/block_syntaxes/long_block_html_syntax.dart deleted file mode 100644 index 89e294a3..00000000 --- a/lib/src/block_syntaxes/long_block_html_syntax.dart +++ /dev/null @@ -1,36 +0,0 @@ -// 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 '../ast.dart'; -import '../block_parser.dart'; -import 'block_html_syntax.dart'; - -/// A BlockHtmlSyntax that has a specific `endPattern`. -/// -/// In practice this means that the syntax dominates; it is allowed to eat -/// many lines, including blank lines, before matching its `endPattern`. -@Deprecated('Use HtmlBlockSyntax instead') -class LongBlockHtmlSyntax extends BlockHtmlSyntax { - @override - final RegExp pattern; - final RegExp _endPattern; - - LongBlockHtmlSyntax(String pattern, String endPattern) - : pattern = RegExp(pattern), - _endPattern = RegExp(endPattern); - - @override - Node parse(BlockParser parser) { - final childLines = []; - // Eat until we hit [endPattern]. - while (!parser.isDone) { - childLines.add(parser.current); - if (parser.matches(_endPattern)) break; - parser.advance(); - } - - parser.advance(); - return Text(childLines.join('\n').trimRight()); - } -} diff --git a/lib/src/block_syntaxes/other_tag_block_html_syntax.dart b/lib/src/block_syntaxes/other_tag_block_html_syntax.dart deleted file mode 100644 index bcdc5c7e..00000000 --- a/lib/src/block_syntaxes/other_tag_block_html_syntax.dart +++ /dev/null @@ -1,26 +0,0 @@ -// 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 '../block_parser.dart'; -import 'block_tag_block_html_syntax.dart'; - -@Deprecated('Use HtmlBlockSyntax instead') -class OtherTagBlockHtmlSyntax extends BlockTagBlockHtmlSyntax { - @override - bool canEndBlock(BlockParser parser) => false; - - // Really hacky way to detect "other" HTML. This matches: - // - // * any opening spaces - // * open bracket and maybe a slash ("<" or " RegExp(r'^ {0,3}|\s+[^>]*>)\s*$'); - - const OtherTagBlockHtmlSyntax(); -} diff --git a/lib/src/inline_syntaxes/tag_syntax.dart b/lib/src/inline_syntaxes/tag_syntax.dart deleted file mode 100644 index 56b51f29..00000000 --- a/lib/src/inline_syntaxes/tag_syntax.dart +++ /dev/null @@ -1,10 +0,0 @@ -// 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 'delimiter_syntax.dart'; - -@Deprecated('Use DelimiterSyntax instead') -class TagSyntax extends DelimiterSyntax { - TagSyntax(super.pattern, {super.requiresDelimiterRun}); -}