Skip to content

Commit 9e856c2

Browse files
authored
Standardize CommonMark spec links to https and v0.30 (dart-archive/markdown#553)
* Standardize CommonMark links to https and v0.30 * Run formatter
1 parent 59c58c9 commit 9e856c2

File tree

11 files changed

+23
-20
lines changed

11 files changed

+23
-20
lines changed

pkgs/markdown/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
## 7.1.2-wip
22

3+
* Update all CommonMark specification links to 0.30.
4+
35
## 7.1.1
46

57
* Fix delimiter row matching pattern for tables.

pkgs/markdown/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ compliance with [CommonMark].
160160

161161
3. Update the stats files as described above. Note any changes in the results.
162162
4. Update any references to the existing spec by search for
163-
`https://spec.commonmark.org/0.28` in the repository. (Including this one.)
163+
`https://spec.commonmark.org/0.30/` in the repository. (Including this one.)
164164
Verify the updated links are still valid.
165165
5. Commit changes, including a corresponding note in `CHANGELOG.md`.
166166

pkgs/markdown/lib/src/block_syntaxes/fenced_code_block_syntax.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ import 'block_syntax.dart';
1111

1212
/// Parses preformatted code blocks between two ~~~ or ``` sequences.
1313
///
14-
/// See the CommonMark spec: https://spec.commonmark.org/0.29/#fenced-code-blocks
14+
/// See the CommonMark spec:
15+
/// https://spec.commonmark.org/0.30/#fenced-code-blocks
1516
class FencedCodeBlockSyntax extends BlockSyntax {
1617
@override
1718
RegExp get pattern => codeFencePattern;

pkgs/markdown/lib/src/block_syntaxes/list_syntax.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@ abstract class ListSyntax extends BlockSyntax {
3535
@override
3636
bool canEndBlock(BlockParser parser) {
3737
// An empty list cannot interrupt a paragraph. See
38-
// https://spec.commonmark.org/0.29/#example-255.
38+
// https://spec.commonmark.org/0.30/#example-285.
3939
// Ideally, [BlockSyntax.canEndBlock] should be changed to be a method
4040
// which accepts a [BlockParser], but this would be a breaking change,
4141
// so we're going with this temporarily.
4242
final match = pattern.firstMatch(parser.current.content)!;
4343

4444
// Allow only lists starting with 1 to interrupt paragraphs, if it is an
4545
// ordered list. See https://spec.commonmark.org/0.30/#example-304.
46-
// But there shuold be an exception for nested ordered lists, for example:
46+
// But there should be an exception for nested ordered lists, for example:
4747
// ```
4848
// 1. one
4949
// 2. two
@@ -276,7 +276,7 @@ abstract class ListSyntax extends BlockSyntax {
276276
}
277277

278278
// Must strip paragraph tags if the list is "tight".
279-
// http://spec.commonmark.org/0.28/#lists
279+
// https://spec.commonmark.org/0.30/#lists
280280
final listIsTight = !anyEmptyLines && !anyEmptyLinesBetweenBlocks;
281281

282282
if (listIsTight) {

pkgs/markdown/lib/src/document.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -191,19 +191,19 @@ extension _ElementExt on Element {
191191
}
192192

193193
/// A [link reference
194-
/// definition](http://spec.commonmark.org/0.28/#link-reference-definitions).
194+
/// definition](https://spec.commonmark.org/0.30/#link-reference-definitions).
195195
class LinkReference {
196-
/// The [link label](http://spec.commonmark.org/0.28/#link-label).
196+
/// The [link label](https://spec.commonmark.org/0.30/#link-label).
197197
///
198198
/// Temporarily, this class is also being used to represent the link data for
199199
/// an inline link (the destination and title), but this should change before
200200
/// the package is released.
201201
final String label;
202202

203-
/// The [link destination](http://spec.commonmark.org/0.28/#link-destination).
203+
/// The [link destination](https://spec.commonmark.org/0.30/#link-destination).
204204
final String destination;
205205

206-
/// The [link title](http://spec.commonmark.org/0.28/#link-title).
206+
/// The [link title](https://spec.commonmark.org/0.30/#link-title).
207207
final String? title;
208208

209209
/// Construct a new [LinkReference], with all necessary fields.

pkgs/markdown/lib/src/inline_parser.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ class InlineParser {
100100
while (!isDone) {
101101
// A right bracket (']') is special. Hitting this character triggers the
102102
// "look for link or image" procedure.
103-
// See https://spec.commonmark.org/0.29/#an-algorithm-for-parsing-nested-emphasis-and-links.
103+
// See https://spec.commonmark.org/0.30/#an-algorithm-for-parsing-nested-emphasis-and-links.
104104
if (charAt(pos) == $rbracket) {
105105
writeText();
106106
_linkOrImage();
@@ -125,7 +125,7 @@ class InlineParser {
125125
/// image.
126126
///
127127
/// This is the "look for link or image" routine from the CommonMark spec:
128-
/// https://spec.commonmark.org/0.29/#-look-for-link-or-image-.
128+
/// https://spec.commonmark.org/0.30/#look-for-link-or-image.
129129
void _linkOrImage() {
130130
final index = _delimiterStack
131131
.lastIndexWhere((d) => d.char == $lbracket || d.char == $exclamation);

pkgs/markdown/lib/src/inline_syntaxes/delimiter_syntax.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class DelimiterSyntax extends InlineSyntax {
1313
/// Whether this is parsed according to the same nesting rules as [emphasis
1414
/// delimiters][].
1515
///
16-
/// [emphasis delimiters]: http://spec.commonmark.org/0.28/#can-open-emphasis
16+
/// [emphasis delimiters]: https://spec.commonmark.org/0.30/#can-open-emphasis
1717
final bool requiresDelimiterRun;
1818

1919
/// Whether to allow intra-word delimiter runs. CommonMark emphasis and
@@ -302,14 +302,14 @@ class DelimiterRun implements Delimiter {
302302
}
303303

304304
// If it is a left-flanking delimiter run, see
305-
// http://spec.commonmark.org/0.30/#left-flanking-delimiter-run.
305+
// https://spec.commonmark.org/0.30/#left-flanking-delimiter-run.
306306
final isLeftFlanking = !followedByWhitespace &&
307307
(!followedByPunctuation ||
308308
precededByWhitespace ||
309309
precededByPunctuation);
310310

311311
// If it is a right-flanking delimiter run, see
312-
// http://spec.commonmark.org/0.30/#right-flanking-delimiter-run.
312+
// https://spec.commonmark.org/0.30/#right-flanking-delimiter-run.
313313
final isRightFlanking = !precededByWhitespace &&
314314
(!precededByPunctuation ||
315315
followedByWhitespace ||

pkgs/markdown/lib/src/inline_syntaxes/email_autolink_syntax.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import 'inline_syntax.dart';
1010

1111
/// Matches autolinks like `<foo@bar.example.com>`.
1212
///
13-
/// See <http://spec.commonmark.org/0.28/#email-address>.
13+
/// See <https://spec.commonmark.org/0.30/#email-address>.
1414
class EmailAutolinkSyntax extends InlineSyntax {
1515
static const _email =
1616
r'''[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}'''

pkgs/markdown/lib/src/inline_syntaxes/inline_html_syntax.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import '../charcode.dart';
77
import '../patterns.dart';
88

99
/// Leave inline HTML tags alone, from
10-
/// [CommonMark 0.30](http://spec.commonmark.org/0.30/#raw-html).
10+
/// [CommonMark 0.30](https://spec.commonmark.org/0.30/#raw-html).
1111
///
1212
/// This is not actually a good definition (nor CommonMark's) of an HTML tag,
1313
/// but it is fast. It will leave text like `<a href='hi">` alone, which is

pkgs/markdown/lib/src/inline_syntaxes/link_syntax.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ class LinkSyntax extends DelimiterSyntax {
281281
parser.advanceBy(1);
282282
final next = parser.charAt(parser.pos);
283283
// TODO: Follow the backslash spec better here.
284-
// http://spec.commonmark.org/0.29/#backslash-escapes
284+
// https://spec.commonmark.org/0.30/#backslash-escapes
285285
if (next != $backslash && next != $gt) {
286286
buffer.writeCharCode(char);
287287
}
@@ -327,7 +327,7 @@ class LinkSyntax extends DelimiterSyntax {
327327
/// Returns the link if it was successfully created, `null` otherwise.
328328
InlineLink? _parseInlineBareDestinationLink(InlineParser parser) {
329329
// According to
330-
// [CommonMark](http://spec.commonmark.org/0.28/#link-destination):
330+
// [CommonMark](https://spec.commonmark.org/0.30/#link-destination):
331331
//
332332
// > A link destination consists of [...] a nonempty sequence of
333333
// > characters [...], and includes parentheses only if (a) they are
@@ -348,7 +348,7 @@ class LinkSyntax extends DelimiterSyntax {
348348
final next = parser.charAt(parser.pos);
349349
// Parentheses may be escaped.
350350
//
351-
// http://spec.commonmark.org/0.28/#example-467
351+
// https://spec.commonmark.org/0.30/#example-494
352352
if (next != $backslash && next != $lparen && next != $rparen) {
353353
buffer.writeCharCode(char);
354354
}

0 commit comments

Comments
 (0)