diff --git a/src/rules.js b/src/rules.js index 61ebd55..2617420 100644 --- a/src/rules.js +++ b/src/rules.js @@ -6,7 +6,7 @@ const FIXER_BN_DIV = "bnToDiv"; const GLOBAL_KEY = "*"; const DEFAULT_SELECTOR = `:is(li, p, h1, h2, h3, h4, h5, h6, dd, blockquote, .kiss-p)`; -const DEFAULT_KEEP_SELECTOR = `code, img, svg, pre`; +const DEFAULT_KEEP_SELECTOR = `code, img, svg, pre, a:has(code)`; const DEFAULT_RULE = { pattern: "", // 匹配网址 selector: "", // 选择器 @@ -104,10 +104,6 @@ const RULES_MAP = { selector: `main ${DEFAULT_SELECTOR}`, keepSelector: DEFAULT_KEEP_SELECTOR, }, - "doc.rust-lang.org": { - selector: `.content ${DEFAULT_SELECTOR}`, - keepSelector: DEFAULT_KEEP_SELECTOR, - }, "www.indiehackers.com": { selector: `h1, h3, .content ${DEFAULT_SELECTOR}, .feed-item__title-link`, }, @@ -248,15 +244,19 @@ const RULES_MAP = { }, "go.dev/tour": { selector: `#left-side ${DEFAULT_SELECTOR}`, - keepSelector: `code, img, svg >>> code`, + keepSelector: DEFAULT_KEEP_SELECTOR, }, "pkg.go.dev": { selector: `.Documentation-content ${DEFAULT_SELECTOR}`, keepSelector: `${DEFAULT_KEEP_SELECTOR}, a, span`, }, - "docs.rs": { + "docs.rs, doc.rust-lang.org/std/, doc.rust-lang.org/nightly/, doc.rust-lang.org/stable/": { selector: `.docblock ${DEFAULT_SELECTOR}, .docblock-short`, - keepSelector: `code >>> code`, + keepSelector: DEFAULT_KEEP_SELECTOR, + }, + "doc.rust-lang.org/book/, doc.rust-lang.org/cargo/, doc.rust-lang.org/rust-by-example/, doc.rust-lang.org/embedded-book/": { + selector: `.content ${DEFAULT_SELECTOR}`, + keepSelector: DEFAULT_KEEP_SELECTOR, }, "randomnerdtutorials.com": { selector: `article ${DEFAULT_SELECTOR}`,