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:
1 parent
c35fdac2e3
commit
68d33b4c54
8 files changed
+680
-5
No files matched your search
@@ -38,7 +38,7 @@ pub(super) fn written(node: &Node, source: &str) -> Option<(Range<usize>, Escape
|
||||
}
|
||||
|
||||
/// A code span's text, one end space cut each side.
|
||||
fn inside(source: &str, whole: Range<usize>, mark: char) -> Range<usize> {
|
||||
pub(crate) fn inside(source: &str, whole: Range<usize>, mark: char) -> Range<usize> {
|
||||
let written = &source[whole.clone()];
|
||||
let open = written.len() - written.trim_start_matches(mark).len();
|
||||
let close = written.len() - written.trim_end_matches(mark).len();
|
||||
|
||||
Reference in new issue
Block a user