Skip to content

Instantly share code, notes, and snippets.

@lukec
Created December 14, 2011 20:55
Show Gist options
  • Save lukec/1478478 to your computer and use it in GitHub Desktop.
Save lukec/1478478 to your computer and use it in GitHub Desktop.
diff --git a/lib/Check/View/Helpers.pm b/lib/Check/View/Helpers.pm
index 3fb000e..d9d2583 100644
--- a/lib/Check/View/Helpers.pm
+++ b/lib/Check/View/Helpers.pm
@@ -171,6 +171,7 @@ sub format_text {
# If Markdown doesn't get to them first, the scrubber
# will pick them up and re-encode them as >
$text =~ s/>/>/g;
+ $text =~ s/`([^`]+)`/my $c = $1; $c =~ s{&lt;}{<}; "`$c`"/egsm;
# Restore & because markdown force corrects it:
$text =~ s/&amp;/&/g;
diff --git a/t/format-user-entered-text.t b/t/format-user-entered-text.t
index 33a455a..268f35d 100644
--- a/t/format-user-entered-text.t
+++ b/t/format-user-entered-text.t
@@ -27,8 +27,9 @@ Named_links: {
"named link");
}
-Backticked_Expressions_with_Links: {
+Backticks: {
text_ok("`Do a thing about https://skitch.com/obra`", '<code>Do a thing about <a href="https://skitch.com/obra" target="_blank">https://skitch.com/obra</a></code>');
+ text_ok("Run: `cowsay <name>`", 'Run: <code>cowsay &lt;name&gt;</code>');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment