Skip to content

Commit 5284c19

Browse files
authored
Use a smaller set of github extensions for markdown (#2002)
* Use a smaller set of github extensions for markdown * Explicit add of the github extensions for markdown
1 parent e68de51 commit 5284c19

File tree

3 files changed

+25
-4
lines changed

3 files changed

+25
-4
lines changed

lib/src/markdown_processor.dart

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,19 @@ final HtmlEscape htmlEscape = const HtmlEscape(HtmlEscapeMode.element);
141141

142142
final List<md.InlineSyntax> _markdown_syntaxes = [
143143
new _InlineCodeSyntax(),
144-
new _AutolinkWithoutScheme()
145-
]..addAll(md.ExtensionSet.gitHubWeb.inlineSyntaxes);
144+
new _AutolinkWithoutScheme(),
145+
md.InlineHtmlSyntax(),
146+
md.StrikethroughSyntax(),
147+
md.AutolinkExtensionSyntax(),
148+
];
149+
150+
final List<md.BlockSyntax> _markdown_block_syntaxes = [
151+
const md.FencedCodeBlockSyntax(),
152+
const md.HeaderWithIdSyntax(),
153+
const md.SetextHeaderWithIdSyntax(),
154+
const md.TableSyntax(),
146155

147-
final List<md.BlockSyntax> _markdown_block_syntaxes = []
148-
..addAll(md.ExtensionSet.gitHubWeb.blockSyntaxes);
156+
];
149157

150158
// Remove these schemas from the display text for hyperlinks.
151159
final RegExp _hide_schemes = new RegExp('^(http|https)://');

test/model_test.dart

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1340,6 +1340,16 @@ void main() {
13401340
'<tbody><tr><td><a href="fake/DocumentWithATable/foo-constant.html">foo</a></td>'),
13411341
isTrue);
13421342
});
1343+
1344+
test('Verify there is no emoji support', () {
1345+
TopLevelVariable tpvar = fakeLibrary.constants.firstWhere((t) => t.name == 'hasMarkdownInDoc');
1346+
docsAsHtml = tpvar.documentationAsHtml;
1347+
expect(
1348+
docsAsHtml.contains(
1349+
'3ffe:2a00:100:7031::1'),
1350+
isTrue);
1351+
});
1352+
13431353
});
13441354

13451355
group('doc references', () {

testing/test_package/lib/fake.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ export 'src/tool.dart';
7070
// ignore: uri_does_not_exist
7171
export 'package:test_package/fake.dart';
7272

73+
/// Does not render with emoji 3ffe:2a00:100:7031::1
74+
const int hasMarkdownInDoc = 1;
75+
7376
abstract class ImplementingThingy implements BaseThingy {}
7477

7578
abstract class BaseThingy {

0 commit comments

Comments
 (0)