Expand description
Optional Markdown features, switched on or off at runtime.
The editor supports the GFM extensions strikethrough, task lists and
tables. Each can be turned off with Features. A disabled feature:
- is not recognised when Markdown is loaded (the text stays a normal
paragraph, e.g.
| a | b |or~~text~~), - has no toolbar button,
- ignores its
Commands and shortcuts (Features::allows), - is not created by autoformat (typing
[ ]or| a | b |+ Enter).
Set the features before loading the document. Switching a feature off later turns its content into text; switching it on again does not restore it.
These are not Cargo features; Cargo features (syntect, images) add
code, these switch editor behaviour.
use iced_markdown_editor::{EditorState, Features};
let mut editor = EditorState::new().features(Features {
tables: false,
..Features::default()
});
editor.set_markdown("| a |\n| - |\n");
assert!(!editor.formatting().table);
assert_eq!(editor.markdown(), "\\| a \\|\n\\| - \\|\n");Structsยง
- Features
- Optional Markdown features. All are enabled by default.