Closed tuomasj closed 8 years ago
Not in markdown, no. If you use the code
helper in another template language, you can pass parameters.
Here is an experiment that I tried: https://github.com/tuomasj/middleman-syntax/blob/no_linenumbers_experiment/lib/middleman-syntax/highlighter.rb#L8
This is not the way this "problem" should be fixed for production, but since I'm the only one using, this will do for me :smile:
So, now I have a syntax called "plain":
```plain
puts "Look ma, no line numbers!"
Actually...
Try this:
```ruby?line_numbers=false
puts "Look ma, no line numbers!"
Hey - I tried ?line_numbers=false but line numbers were still present. Anything else you advise?
relevant config.rb:
set :markdown_engine, :redcarpet
set :markdown, :fenced_code_blocks => true, :smartypants => true
activate :syntax, :line_numbers => true
versions: middleman: (3.3.12) middleman-blog: (3.5.3) middleman-syntax: (2.1.0) redcarpet (3.3.4)
Yeah, looks like we'd need to make some changes for that to work.
```ruby?line_numbers=false
puts "Look ma, no line numbers parameter is working now!"
Here is the commit for working version with Redcarpet: https://github.com/tuomasj/middleman-syntax/commit/3d19e5b544648eddf86ae27324fa7fc1a2edba4a
When using redcarpet this language parameter approach works, but Kramdown handles the language parameter differently. Any suggestions what would be the best approach?
Neat! Wanna send a PR? I'm not sure Kramdown will make this available.
Yeah, I'll send it as soon as I remove all Kramdown releated stuff
Created a pull request #63, closing this issue. If there are any addition discussions, the pull request is better place for it.
Hi,
Is there a way to disable line numbers on specific code block? Generally, I want to have line numbers on my code blocks but there are occasions where I would like to disable line numbers on specific code block.
I'm using markdown with fenced code blocks.
This is a markdown code block with ruby with line numbers, just for an example:
This is a markdown code block where I would like to disable line numbers:
This is just an imaginary example, there is no
nolinenumbers
syntax.middleman init MY_PROJECT bundle exec middleman serve