Skip to content

Commit 10782bb

Browse files
bors[bot]Veykril
andauthored
Merge #10685
10685: fix: Enable markdown tables r=Veykril a=Veykril Should fix #10655 bors r+ Co-authored-by: Lukas Wirth <[email protected]>
2 parents 8720281 + 4d4574f commit 10782bb

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

crates/ide/src/doc_links.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,13 @@ use crate::{
3232
/// Weblink to an item's documentation.
3333
pub(crate) type DocumentationLink = String;
3434

35+
const MARKDOWN_OPTIONS: Options =
36+
Options::ENABLE_FOOTNOTES.union(Options::ENABLE_TABLES).union(Options::ENABLE_TASKLISTS);
37+
3538
/// Rewrite documentation links in markdown to point to an online host (e.g. docs.rs)
3639
pub(crate) fn rewrite_links(db: &RootDatabase, markdown: &str, definition: Definition) -> String {
3740
let mut cb = broken_link_clone_cb;
38-
let doc =
39-
Parser::new_with_broken_link_callback(markdown, Options::ENABLE_TASKLISTS, Some(&mut cb));
41+
let doc = Parser::new_with_broken_link_callback(markdown, MARKDOWN_OPTIONS, Some(&mut cb));
4042

4143
let doc = map_links(doc, |target, title| {
4244
// This check is imperfect, there's some overlap between valid intra-doc links
@@ -75,13 +77,11 @@ pub(crate) fn rewrite_links(db: &RootDatabase, markdown: &str, definition: Defin
7577
pub(crate) fn remove_links(markdown: &str) -> String {
7678
let mut drop_link = false;
7779

78-
let opts = Options::ENABLE_TASKLISTS | Options::ENABLE_FOOTNOTES;
79-
8080
let mut cb = |_: BrokenLink| {
8181
let empty = InlineStr::try_from("").unwrap();
8282
Some((CowStr::Inlined(empty), CowStr::Inlined(empty)))
8383
};
84-
let doc = Parser::new_with_broken_link_callback(markdown, opts, Some(&mut cb));
84+
let doc = Parser::new_with_broken_link_callback(markdown, MARKDOWN_OPTIONS, Some(&mut cb));
8585
let doc = doc.filter_map(move |evt| match evt {
8686
Event::Start(Tag::Link(link_type, target, title)) => {
8787
if link_type == LinkType::Inline && target.contains("://") {
@@ -151,7 +151,7 @@ pub(crate) fn extract_definitions_from_docs(
151151
) -> Vec<(TextRange, String, Option<hir::Namespace>)> {
152152
Parser::new_with_broken_link_callback(
153153
docs.as_str(),
154-
Options::ENABLE_TASKLISTS,
154+
MARKDOWN_OPTIONS,
155155
Some(&mut broken_link_clone_cb),
156156
)
157157
.into_offset_iter()

0 commit comments

Comments
 (0)