ConversionOptions.fromJson constructor
ConversionOptions.fromJson(
- Map<String, dynamic> json
)
Implementation
factory ConversionOptions.fromJson(Map<String, dynamic> json) {
return ConversionOptions(
headingStyle:
HeadingStyle.fromJson((json['heading_style'] as String?) ?? 'atx'),
listIndentType: ListIndentType.fromJson(
(json['list_indent_type'] as String?) ?? 'spaces'),
listIndentWidth: json['list_indent_width'] as int? ?? 2,
bullets: (json['bullets'] as String?) ?? '-',
strongEmSymbol: (json['strong_em_symbol'] as String?) ?? '*',
escapeAsterisks: json['escape_asterisks'] as bool? ?? true,
escapeUnderscores: json['escape_underscores'] as bool? ?? true,
escapeMisc: json['escape_misc'] as bool? ?? false,
escapeAscii: json['escape_ascii'] as bool? ?? false,
codeLanguage: (json['code_language'] as String?) ?? '',
autolinks: json['autolinks'] as bool? ?? true,
defaultTitle: json['default_title'] as bool? ?? false,
brInTables: json['br_in_tables'] as bool? ?? false,
highlightStyle: HighlightStyle.fromJson(
(json['highlight_style'] as String?) ?? 'standard'),
extractMetadata: json['extract_metadata'] as bool? ?? false,
whitespaceMode: WhitespaceMode.fromJson(
(json['whitespace_mode'] as String?) ?? 'normal'),
stripNewlines: json['strip_newlines'] as bool? ?? false,
wrap: json['wrap'] as bool? ?? false,
wrapWidth: json['wrap_width'] as int? ?? 80,
convertAsInline: json['convert_as_inline'] as bool? ?? false,
subSymbol: (json['sub_symbol'] as String?) ?? '~',
supSymbol: (json['sup_symbol'] as String?) ?? '^',
newlineStyle:
NewlineStyle.fromJson((json['newline_style'] as String?) ?? 'lf'),
codeBlockStyle: CodeBlockStyle.fromJson(
(json['code_block_style'] as String?) ?? 'fenced'),
keepInlineImagesIn:
(json['keep_inline_images_in'] as List?)?.cast<String>() ?? [],
preprocessing: json['preprocessing'] != null
? PreprocessingOptions.fromJson(
json['preprocessing'] as Map<String, dynamic>)
: const PreprocessingOptions(),
encoding: (json['encoding'] as String?) ?? 'utf-8',
debug: json['debug'] as bool? ?? false,
stripTags: (json['strip_tags'] as List?)?.cast<String>() ?? [],
preserveTags: (json['preserve_tags'] as List?)?.cast<String>() ?? [],
skipImages: json['skip_images'] as bool? ?? false,
linkStyle:
LinkStyle.fromJson((json['link_style'] as String?) ?? 'inlined'),
outputFormat: OutputFormat.fromJson(
(json['output_format'] as String?) ?? 'standard'),
includeDocumentStructure:
json['include_document_structure'] as bool? ?? false,
extractImages: json['extract_images'] as bool? ?? false,
maxImageSize: json['max_image_size'] as int? ?? 5242880,
captureSvg: json['capture_svg'] as bool? ?? false,
inferDimensions: json['infer_dimensions'] as bool? ?? false,
maxDepth: json['max_depth'] as int?,
excludeSelectors:
(json['exclude_selectors'] as List?)?.cast<String>() ?? [],
);
}