Document constructor
Document({
- Iterable<
BlockSyntax> ? blockSyntaxes, - Iterable<
InlineSyntax> ? inlineSyntaxes, - ExtensionSet? extensionSet,
- Resolver? linkResolver,
- Resolver? imageLinkResolver,
- bool encodeHtml = true,
- bool withDefaultBlockSyntaxes = true,
- bool withDefaultInlineSyntaxes = true,
Implementation
Document({
Iterable<BlockSyntax>? blockSyntaxes,
Iterable<InlineSyntax>? inlineSyntaxes,
ExtensionSet? extensionSet,
this.linkResolver,
this.imageLinkResolver,
this.encodeHtml = true,
this.withDefaultBlockSyntaxes = true,
this.withDefaultInlineSyntaxes = true,
}) : hasCustomInlineSyntaxes = (inlineSyntaxes?.isNotEmpty ?? false) ||
(extensionSet?.inlineSyntaxes.isNotEmpty ?? false) {
if (blockSyntaxes != null) {
_blockSyntaxes.addAll(blockSyntaxes);
}
if (inlineSyntaxes != null) {
_inlineSyntaxes.addAll(inlineSyntaxes);
}
if (extensionSet == null) {
if (withDefaultBlockSyntaxes) {
_blockSyntaxes.addAll(ExtensionSet.commonMark.blockSyntaxes);
}
if (withDefaultInlineSyntaxes) {
_inlineSyntaxes.addAll(ExtensionSet.commonMark.inlineSyntaxes);
}
} else {
_blockSyntaxes.addAll(extensionSet.blockSyntaxes);
_inlineSyntaxes.addAll(extensionSet.inlineSyntaxes);
}
}