mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-10-21 04:33:26 +08:00
Simplify code
This commit is contained in:
@ -127,23 +127,18 @@ class MarkdownRenderer extends StatelessWidget {
|
|||||||
|
|
||||||
static md.ExtensionSet markdownExtensions({bool hardWrapEnabled = false}) {
|
static md.ExtensionSet markdownExtensions({bool hardWrapEnabled = false}) {
|
||||||
// It's important to add both these inline syntaxes before the other
|
// It's important to add both these inline syntaxes before the other
|
||||||
// syntaxes as the LinkSyntax intefers with both of these
|
// syntaxes as the LinkSyntax intefers with WikiLinks and TaskLists
|
||||||
|
var inline = [
|
||||||
|
HtmlEntitiesSyntax(),
|
||||||
|
if (hardWrapEnabled) HardWrapSyntax(),
|
||||||
|
WikiLinkSyntax(),
|
||||||
|
TaskListSyntax(),
|
||||||
|
...md.ExtensionSet.gitHubFlavored.inlineSyntaxes,
|
||||||
|
];
|
||||||
|
|
||||||
var markdownExtensions = md.ExtensionSet(
|
var markdownExtensions = md.ExtensionSet(
|
||||||
md.ExtensionSet.gitHubFlavored.blockSyntaxes,
|
md.ExtensionSet.gitHubFlavored.blockSyntaxes,
|
||||||
hardWrapEnabled
|
inline,
|
||||||
? [
|
|
||||||
HtmlEntitiesSyntax(),
|
|
||||||
HardWrapSyntax(),
|
|
||||||
WikiLinkSyntax(),
|
|
||||||
TaskListSyntax(),
|
|
||||||
...md.ExtensionSet.gitHubFlavored.inlineSyntaxes,
|
|
||||||
]
|
|
||||||
: [
|
|
||||||
HtmlEntitiesSyntax(),
|
|
||||||
WikiLinkSyntax(),
|
|
||||||
TaskListSyntax(),
|
|
||||||
...md.ExtensionSet.gitHubFlavored.inlineSyntaxes,
|
|
||||||
],
|
|
||||||
);
|
);
|
||||||
return markdownExtensions;
|
return markdownExtensions;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user