Standardize CommonMark spec links to https and v0.30 (dart-lang/markdown#553)
* Standardize CommonMark links to https and v0.30
* Run formatter
diff --git a/pkgs/markdown/CHANGELOG.md b/pkgs/markdown/CHANGELOG.md
index 272702d..6f275c9 100644
--- a/pkgs/markdown/CHANGELOG.md
+++ b/pkgs/markdown/CHANGELOG.md
@@ -1,5 +1,7 @@
## 7.1.2-wip
+* Update all CommonMark specification links to 0.30.
+
## 7.1.1
* Fix delimiter row matching pattern for tables.
diff --git a/pkgs/markdown/README.md b/pkgs/markdown/README.md
index 871b54b..b1c8695 100644
--- a/pkgs/markdown/README.md
+++ b/pkgs/markdown/README.md
@@ -160,7 +160,7 @@
3. Update the stats files as described above. Note any changes in the results.
4. Update any references to the existing spec by search for
- `https://spec.commonmark.org/0.28` in the repository. (Including this one.)
+ `https://spec.commonmark.org/0.30/` in the repository. (Including this one.)
Verify the updated links are still valid.
5. Commit changes, including a corresponding note in `CHANGELOG.md`.
diff --git a/pkgs/markdown/lib/src/block_syntaxes/fenced_code_block_syntax.dart b/pkgs/markdown/lib/src/block_syntaxes/fenced_code_block_syntax.dart
index e4086d6..cea1106 100644
--- a/pkgs/markdown/lib/src/block_syntaxes/fenced_code_block_syntax.dart
+++ b/pkgs/markdown/lib/src/block_syntaxes/fenced_code_block_syntax.dart
@@ -11,7 +11,8 @@
/// Parses preformatted code blocks between two ~~~ or ``` sequences.
///
-/// See the CommonMark spec: https://spec.commonmark.org/0.29/#fenced-code-blocks
+/// See the CommonMark spec:
+/// https://spec.commonmark.org/0.30/#fenced-code-blocks
class FencedCodeBlockSyntax extends BlockSyntax {
@override
RegExp get pattern => codeFencePattern;
diff --git a/pkgs/markdown/lib/src/block_syntaxes/list_syntax.dart b/pkgs/markdown/lib/src/block_syntaxes/list_syntax.dart
index 5ca3451..c911ee7 100644
--- a/pkgs/markdown/lib/src/block_syntaxes/list_syntax.dart
+++ b/pkgs/markdown/lib/src/block_syntaxes/list_syntax.dart
@@ -35,7 +35,7 @@
@override
bool canEndBlock(BlockParser parser) {
// An empty list cannot interrupt a paragraph. See
- // https://spec.commonmark.org/0.29/#example-255.
+ // https://spec.commonmark.org/0.30/#example-285.
// Ideally, [BlockSyntax.canEndBlock] should be changed to be a method
// which accepts a [BlockParser], but this would be a breaking change,
// so we're going with this temporarily.
@@ -43,7 +43,7 @@
// Allow only lists starting with 1 to interrupt paragraphs, if it is an
// ordered list. See https://spec.commonmark.org/0.30/#example-304.
- // But there shuold be an exception for nested ordered lists, for example:
+ // But there should be an exception for nested ordered lists, for example:
// ```
// 1. one
// 2. two
@@ -276,7 +276,7 @@
}
// Must strip paragraph tags if the list is "tight".
- // http://spec.commonmark.org/0.28/#lists
+ // https://spec.commonmark.org/0.30/#lists
final listIsTight = !anyEmptyLines && !anyEmptyLinesBetweenBlocks;
if (listIsTight) {
diff --git a/pkgs/markdown/lib/src/document.dart b/pkgs/markdown/lib/src/document.dart
index e68579a..b04fa07 100644
--- a/pkgs/markdown/lib/src/document.dart
+++ b/pkgs/markdown/lib/src/document.dart
@@ -191,19 +191,19 @@
}
/// A [link reference
-/// definition](http://spec.commonmark.org/0.28/#link-reference-definitions).
+/// definition](https://spec.commonmark.org/0.30/#link-reference-definitions).
class LinkReference {
- /// The [link label](http://spec.commonmark.org/0.28/#link-label).
+ /// The [link label](https://spec.commonmark.org/0.30/#link-label).
///
/// Temporarily, this class is also being used to represent the link data for
/// an inline link (the destination and title), but this should change before
/// the package is released.
final String label;
- /// The [link destination](http://spec.commonmark.org/0.28/#link-destination).
+ /// The [link destination](https://spec.commonmark.org/0.30/#link-destination).
final String destination;
- /// The [link title](http://spec.commonmark.org/0.28/#link-title).
+ /// The [link title](https://spec.commonmark.org/0.30/#link-title).
final String? title;
/// Construct a new [LinkReference], with all necessary fields.
diff --git a/pkgs/markdown/lib/src/inline_parser.dart b/pkgs/markdown/lib/src/inline_parser.dart
index 27ab695..e700ecf 100644
--- a/pkgs/markdown/lib/src/inline_parser.dart
+++ b/pkgs/markdown/lib/src/inline_parser.dart
@@ -100,7 +100,7 @@
while (!isDone) {
// A right bracket (']') is special. Hitting this character triggers the
// "look for link or image" procedure.
- // See https://spec.commonmark.org/0.29/#an-algorithm-for-parsing-nested-emphasis-and-links.
+ // See https://spec.commonmark.org/0.30/#an-algorithm-for-parsing-nested-emphasis-and-links.
if (charAt(pos) == $rbracket) {
writeText();
_linkOrImage();
@@ -125,7 +125,7 @@
/// image.
///
/// This is the "look for link or image" routine from the CommonMark spec:
- /// https://spec.commonmark.org/0.29/#-look-for-link-or-image-.
+ /// https://spec.commonmark.org/0.30/#look-for-link-or-image.
void _linkOrImage() {
final index = _delimiterStack
.lastIndexWhere((d) => d.char == $lbracket || d.char == $exclamation);
diff --git a/pkgs/markdown/lib/src/inline_syntaxes/delimiter_syntax.dart b/pkgs/markdown/lib/src/inline_syntaxes/delimiter_syntax.dart
index 5a7437a..f26bdc9 100644
--- a/pkgs/markdown/lib/src/inline_syntaxes/delimiter_syntax.dart
+++ b/pkgs/markdown/lib/src/inline_syntaxes/delimiter_syntax.dart
@@ -13,7 +13,7 @@
/// Whether this is parsed according to the same nesting rules as [emphasis
/// delimiters][].
///
- /// [emphasis delimiters]: http://spec.commonmark.org/0.28/#can-open-emphasis
+ /// [emphasis delimiters]: https://spec.commonmark.org/0.30/#can-open-emphasis
final bool requiresDelimiterRun;
/// Whether to allow intra-word delimiter runs. CommonMark emphasis and
@@ -302,14 +302,14 @@
}
// If it is a left-flanking delimiter run, see
- // http://spec.commonmark.org/0.30/#left-flanking-delimiter-run.
+ // https://spec.commonmark.org/0.30/#left-flanking-delimiter-run.
final isLeftFlanking = !followedByWhitespace &&
(!followedByPunctuation ||
precededByWhitespace ||
precededByPunctuation);
// If it is a right-flanking delimiter run, see
- // http://spec.commonmark.org/0.30/#right-flanking-delimiter-run.
+ // https://spec.commonmark.org/0.30/#right-flanking-delimiter-run.
final isRightFlanking = !precededByWhitespace &&
(!precededByPunctuation ||
followedByWhitespace ||
diff --git a/pkgs/markdown/lib/src/inline_syntaxes/email_autolink_syntax.dart b/pkgs/markdown/lib/src/inline_syntaxes/email_autolink_syntax.dart
index e7b90ff..212f1a4 100644
--- a/pkgs/markdown/lib/src/inline_syntaxes/email_autolink_syntax.dart
+++ b/pkgs/markdown/lib/src/inline_syntaxes/email_autolink_syntax.dart
@@ -10,7 +10,7 @@
/// Matches autolinks like `<foo@bar.example.com>`.
///
-/// See <http://spec.commonmark.org/0.28/#email-address>.
+/// See <https://spec.commonmark.org/0.30/#email-address>.
class EmailAutolinkSyntax extends InlineSyntax {
static const _email =
r'''[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}'''
diff --git a/pkgs/markdown/lib/src/inline_syntaxes/inline_html_syntax.dart b/pkgs/markdown/lib/src/inline_syntaxes/inline_html_syntax.dart
index fb5b528..3a7ce77 100644
--- a/pkgs/markdown/lib/src/inline_syntaxes/inline_html_syntax.dart
+++ b/pkgs/markdown/lib/src/inline_syntaxes/inline_html_syntax.dart
@@ -7,7 +7,7 @@
import '../patterns.dart';
/// Leave inline HTML tags alone, from
-/// [CommonMark 0.30](http://spec.commonmark.org/0.30/#raw-html).
+/// [CommonMark 0.30](https://spec.commonmark.org/0.30/#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
diff --git a/pkgs/markdown/lib/src/inline_syntaxes/link_syntax.dart b/pkgs/markdown/lib/src/inline_syntaxes/link_syntax.dart
index 7499ce4..7b3c304 100644
--- a/pkgs/markdown/lib/src/inline_syntaxes/link_syntax.dart
+++ b/pkgs/markdown/lib/src/inline_syntaxes/link_syntax.dart
@@ -281,7 +281,7 @@
parser.advanceBy(1);
final next = parser.charAt(parser.pos);
// TODO: Follow the backslash spec better here.
- // http://spec.commonmark.org/0.29/#backslash-escapes
+ // https://spec.commonmark.org/0.30/#backslash-escapes
if (next != $backslash && next != $gt) {
buffer.writeCharCode(char);
}
@@ -327,7 +327,7 @@
/// Returns the link if it was successfully created, `null` otherwise.
InlineLink? _parseInlineBareDestinationLink(InlineParser parser) {
// According to
- // [CommonMark](http://spec.commonmark.org/0.28/#link-destination):
+ // [CommonMark](https://spec.commonmark.org/0.30/#link-destination):
//
// > A link destination consists of [...] a nonempty sequence of
// > characters [...], and includes parentheses only if (a) they are
@@ -348,7 +348,7 @@
final next = parser.charAt(parser.pos);
// Parentheses may be escaped.
//
- // http://spec.commonmark.org/0.28/#example-467
+ // https://spec.commonmark.org/0.30/#example-494
if (next != $backslash && next != $lparen && next != $rparen) {
buffer.writeCharCode(char);
}
diff --git a/pkgs/markdown/tool/stats_lib.dart b/pkgs/markdown/tool/stats_lib.dart
index d88946f..5ff6321 100644
--- a/pkgs/markdown/tool/stats_lib.dart
+++ b/pkgs/markdown/tool/stats_lib.dart
@@ -60,7 +60,7 @@
class Config {
static final Config commonMarkConfig = Config._(
'common_mark',
- 'http://spec.commonmark.org/0.28/',
+ 'https://spec.commonmark.org/0.30/',
);
static final Config gfmConfig = Config._(
'gfm',