Skip to content

Commit

Permalink
fix: added backticks around source code link
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed Oct 27, 2024
1 parent f7efb93 commit 53121fa
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/src/docs/markdown/renderer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,11 @@ impl MarkdownRenderer {
ctx.insert("path", &path);
let href = TERA.clone().render_str(source_code_link_template, &ctx)?;
let friendly = path_re.replace_all(&href, "").to_string();
let link = format!("[{friendly}]({href})");
let link = if path_re.is_match(&href) {
format!("[`{friendly}`]({href})")
} else {
format!("[{friendly}]({href})")
};
Ok(link.into())
} else {
Ok("".into())
Expand Down

0 comments on commit 53121fa

Please sign in to comment.