Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions pkgs/markdown/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
without ampersands.
* Split a fenced code block info string at the first space or tab, so a
tab no longer ends up inside the `language-` class (matching cmark and
commonmark.js). Also return early from `escapePunctuation` when the input
has no backslash.
commonmark.js).
* Sort footnote definitions by their case-insensitive labels rather than
their URI-encoded HTML IDs, so Unicode and escaped labels keep
first-reference order.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,7 @@ class _FenceMatch {
}

// We assume the info string is trimmed already.
var separatorIndex = info.indexOf(' ');
final tabIndex = info.indexOf('\t');
if (separatorIndex == -1 || (tabIndex != -1 && tabIndex < separatorIndex)) {
separatorIndex = tabIndex;
}
final separatorIndex = info.indexOf(RegExp(r'[ \t]'));
if (separatorIndex == -1) {
return (info, null);
}
Expand Down
1 change: 0 additions & 1 deletion pkgs/markdown/lib/src/util.dart
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ extension MatchExtensions on Match {

/// Escapes the ASCII punctuation characters after backslash(`\`).
String escapePunctuation(String input) {
if (!input.contains(r'\')) return input;
final buffer = StringBuffer();

for (var i = 0; i < input.length; i++) {
Expand Down
11 changes: 0 additions & 11 deletions pkgs/markdown/test/util_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -106,17 +106,6 @@ void main() {
expect(decodeHtmlCharacters('&#65;'), 'A');
});
});

group('escapePunctuation', () {
test('keeps unescaped content intact', () {
expect(escapePunctuation('fence language'), 'fence language');
});

test('removes punctuation escapes but not ordinary backslashes', () {
expect(escapePunctuation(r'\*escaped\!'), '*escaped!');
expect(escapePunctuation(r'\a'), r'\a');
});
});
}

extension on Line {
Expand Down
Loading