2

I would like to display a dollar sign inside a code span generated with maven-site-plugin and markdown (doxia-module-markdown).

Out of a code span, I used the numerical code $ and it fixed the issue. But inside a code span (4 spaces), the numerical code is not decoded, which is actually not suprising :

Within a code block, ampersands (&) and angle brackets (< and >) are automatically converted into HTML entities.

(from http://daringfireball.net/projects/markdown/syntax#code)

I also tried to double the dollar sign ($$), escape it (\$), charm it (<3$), but nothing worked!

Does someone have any idea?

Duncan Jones
  • 67,400
  • 29
  • 193
  • 254
tduchateau
  • 4,351
  • 2
  • 29
  • 40
  • +1 I love your effort to charm the dollar. – Duncan Jones Nov 24 '12 at 08:10
  • Also, are you sure you need to be escaping a dollar elsewhere on your page? Unless it's a special character for doxia (which I didn't think it was), then it [might not be necessary](http://stackoverflow.com/questions/436615/when-should-one-use-html-entities). – Duncan Jones Nov 24 '12 at 08:15

1 Answers1

0

You can use a raw dollar sign within a code block. There is even a small example of this in the doxia syntax page:

Blockquotes can contain other Markdown elements, including headers, lists, and code blocks:

> ## This is a header.  
>   
> 1.   This is the first list item.  
> 2.   This is the second list item.  
>   
> Here's some example code:  
>   
>     return shell_exec("echo $input | $markdown_script");

In the example above, the dollars are unescaped.

Duncan Jones
  • 67,400
  • 29
  • 193
  • 254
  • 1
    Hi Duncan. Actually it works in a code block most of the time. But not for : "$.fn." : the dollar sign disappears. I had to add a ugly space after the "$" sign ("$ .fn.") to prevent it from disappearing ! Any explanation ? – tduchateau Nov 29 '12 at 08:16
  • You can find an example [here](http://datatables4j.github.com/docs/advanced.extrafile.html#example--custom-row-filtering) – tduchateau Nov 29 '12 at 08:25