[kramdown-users] CLI Suppress coderay line-numbering

Thomas Leitner t_leitner at gmx.at
Sat Jun 2 04:59:35 UTC 2012


On 2012-06-01 12:21 -0700 Lou Quillio wrote:
> 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?

This is just the default setting and it makes sense that the default
settings are the same regardless of the kind of invocation of kramdown.

One thing which is a bug is that the documentation of the options on
the CLI is wrong since you can't pass a Ruby Symbol type to the
options handler but one has to use a String.

Another thing which is not quite a bug but unfriendly behaviour is that
setting a nil value can only be done by providing a whitespace string
like ' ' to an option - I will fix this.

> 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>
> 

You can use the following command line:

    $ kramdown <infile> --coderay-css style --coderay-line-numbers ' ' --template <template> 

> 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.

Noted on my TODO list. Will probably become some option like
coderay-default-syntax.

Cheers,
  Thomas


More information about the kramdown-users mailing list