[kramdown-users] CLI Suppress coderay line-numbering

Lou Quillio public at quillio.com
Fri Jun 1 19:21:05 UTC 2012


The kramdown CLI tool (v0.13.6) seems to default the
`--coderay-line-numbers` argument to inline, rather than nil, and
insists on a `table`, `list` or `inline` value.  Is this a bug, or am
I missing something?

It's easy enough to suppress the generated line numbers (in HTML
output) on the CSS layer, but the tool also adds leading space to each
line of code, which is picked up in copy-paste operations from a
browser, so is undesirable.  Example:

<div>
  <div class="CodeRay">
    <div class="code">
<pre><span class="no">1</span> I am a line of code, with leading <span
style="color:#00D;font-weight:bold">space inserted</span>;
<span class="no">2</span> I am another line of code;
</pre>
    </div>
  </div>
</div>


My specific interest is to do something like ...

$ kramdown <infile> --template <template file> --coderay-css style > <outfile>

... and get HTML output with inline (`style` attribute) syntax
highlighting but no generated line numbers.  Currently I use this
workaround:

$ kramdown <infile> --template <template file> --coderay-css style | \
  perl -p -e 's|<span class="no">.*?</span>\s||gm' > <outfile>

Any help appreciated.

Feature request:  The ability to specify, as a command line argument,
a default CodeRay syntax type for code blocks, to be applied to blocks
lacking a `:lang=` declaration.  In many cases (though not all), this
would allow markdown-text input to avoid embedded syntax declarations,
keeping the source a little cleaner.

Thanks again.  Great tool.

LQ


-- 
Lou Quillio
http://quillio.com/


More information about the kramdown-users mailing list