//! Node and mark names of the note layout, and the text style expand rules. use loro::{ExpandType, StyleConfig, StyleConfigMap}; pub const NODE_DOC: &str = "doc"; pub const NODE_PARAGRAPH: &str = "paragraph"; pub const NODE_HEADING: &str = "heading"; pub const NODE_CODE_BLOCK: &str = "code_block"; pub const NODE_BLOCKQUOTE: &str = "blockquote"; pub const NODE_HORIZONTAL_RULE: &str = "horizontal_rule"; pub const NODE_BULLET_LIST: &str = "bullet_list"; pub const NODE_ORDERED_LIST: &str = "ordered_list"; pub const NODE_LIST_ITEM: &str = "list_item"; pub const NODE_HARD_BREAK: &str = "hard_break"; pub const NODE_IMAGE: &str = "image"; pub const MARK_STRONG: &str = "strong"; pub const MARK_EM: &str = "em"; pub const MARK_CODE: &str = "code"; pub const MARK_LINK: &str = "link"; /// Expand rules of every mark key: inline marks grow at their end like ProseMirror's. pub fn text_style_config() -> StyleConfigMap { let mut styles = StyleConfigMap::new(); styles.insert( MARK_STRONG.into(), StyleConfig::new().expand(ExpandType::After), ); styles.insert(MARK_EM.into(), StyleConfig::new().expand(ExpandType::After)); styles.insert( MARK_CODE.into(), StyleConfig::new().expand(ExpandType::After), ); styles.insert( MARK_LINK.into(), StyleConfig::new().expand(ExpandType::None), ); // Block attributes on separators, and images: never lent to inserted text. for key in crate::flat::BLOCK_KEYS.iter().chain(&[crate::flat::KEY_IMAGE]) { styles.insert((*key).into(), StyleConfig::new().expand(ExpandType::None)); } styles }