diff --git a/src/rules/broken_wikilink.rs b/src/rules/broken_wikilink.rs index 2b55879..a5de794 100644 --- a/src/rules/broken_wikilink.rs +++ b/src/rules/broken_wikilink.rs @@ -122,15 +122,16 @@ impl Visitor for BrokenWikilinkVisitor { let wikilinks = self.wikilinks_visitor.wikilinks.clone(); for wikilink in wikilinks { let alias = wikilink.alias; + let id = format!("{CODE}::{filename}::{alias}"); if !self.alias_table.contains_key(&alias) { self.broken_wikilinks.push( BrokenWikilink::builder() - .id(format!("{CODE}::{filename}::{alias}").into()) - .src(NamedSource::new(path.to_string_lossy(), source.to_string())) - .wikilink(wikilink.span) .advice(format!( - "Create a page or alias on an existing page for '{alias}' (case insensitive), or fix the wikilinks spelling" + "Create a page or alias on an existing page for '{alias}' (case insensitive), or fix the wikilinks spelling.\nid: {id:?}" )) + .id(id.into()) + .src(NamedSource::new(path.to_string_lossy(), source.to_string())) + .wikilink(wikilink.span) .alias(alias) .build(), ); diff --git a/src/rules/duplicate_alias.rs b/src/rules/duplicate_alias.rs index 1236600..ec3e025 100644 --- a/src/rules/duplicate_alias.rs +++ b/src/rules/duplicate_alias.rs @@ -62,6 +62,10 @@ pub enum DuplicateAlias { /// Put an exact copy but using the other file in src #[related] other: Vec, + + /// Just some advice + #[help] + advice: String, }, } impl ReportTrait for DuplicateAlias { @@ -301,11 +305,13 @@ impl DuplicateAlias { ); Ok(DuplicateAlias::FileContentContentDuplicate { + advice: format!("id: {id:?}"), id: id.clone().into(), other_filename: get_filename(file2_path), src: NamedSource::new(file1_path.to_string_lossy(), file1_content.to_string()), alias: file1_content_span, other: vec![DuplicateAlias::FileContentContentDuplicate { + advice: format!("id: {id:?}"), id: id.into(), other_filename: get_filename(file1_path), src: NamedSource::new(file2_path.to_string_lossy(), file2_content.to_string()), diff --git a/src/rules/unlinked_text.rs b/src/rules/unlinked_text.rs index 0120a62..3c996ef 100644 --- a/src/rules/unlinked_text.rs +++ b/src/rules/unlinked_text.rs @@ -216,15 +216,16 @@ impl Visitor for UnlinkedTextVisitor { ) -> std::result::Result<(), FinalizeError> { for (alias, span) in &mut self.new_unlinked_texts { let filename = get_filename(path); + let id = format!("{CODE}::{filename}::{alias}"); self.unlinked_texts.push( UnlinkedText::builder() - .id(ErrorCode::new(format!("{CODE}::{filename}::{alias}"))) + .advice(format!( + "Consider wrapping it in a wikilink, like: [[{alias}]]\nNOTE: If running in --fix, you may need to run fix more than once to fix all unlinked text errors.\n I recommend doing this one at a time.\nREF: https://github.com/ryanpeach/mdlinker/issues/44\nid: {id:?}" + )) + .id(id.into()) .src(NamedSource::new(path.to_string_lossy(), source.to_string())) .alias(alias.clone()) .span(*span) - .advice(format!( - "Consider wrapping it in a wikilink, like: [[{alias}]]\nNOTE: If running in --fix, you may need to run fix more than once to fix all unlinked text errors.\n I recommend doing this one at a time.\nREF: https://github.com/ryanpeach/mdlinker/issues/44" - )) .build(), ); }