documents: inline formats toggle as Typora's

MarkdownDocument::format toggles bold, italic, code, strike, underline,
link and image at the selection, or clears every inline mark from the
blocks it touches, following Typora's toggleStyle: off inside the style,
wrap a selection, take the caret's word or write an empty pair. Code,
math, HTML and front matter refuse, as does a selection crossing a
block, a link or another mark. An open block keeps its field open.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
ZacharyZhang-NYandClaude Opus 5.5 committed 2026-10-14 11:51:24 -04:00
1 parent c35fdac2e3
commit 68d33b4c54
8 files changed
+680 -5

No files matched your search

+2 -2
View File
@@ -36,8 +36,8 @@ pub use counts::{ReadingTime, WordCount};
pub use diagram::{Diagram, diagram_svg};
pub(crate) use diagram::{flatten, options as svg_options};
pub use document::{
Attachment, DocumentEvent, DocumentHeading, DocumentLook, DocumentTarget, LARGEST_READ,
MarkdownDocument, TableEdit, TableRefusal, TargetBlock,
Attachment, DocumentEvent, DocumentHeading, DocumentLook, DocumentTarget, FormatRefusal,
InlineFormat, LARGEST_READ, MarkdownDocument, TableEdit, TableRefusal, TargetBlock,
};
pub use epub::{Chapter, EpubReader};
pub use format::{Format, format};