Closed jorilallo closed 8 years ago
I think this is a question for https://github.com/jneen/rouge - this plugin simply ties Rouge into Middleman.
Fair enough, thanks @bhollis
Rouge does support ignoring the opening tags, but it's a setting on the lexer: https://github.com/jneen/rouge/blob/76647eb9e297de11ba3b174a45f1ae1ed4a34f8e/lib/rouge/lexers/php.rb#L21
Unfortunately I haven't been able to figure out how to set that trough middleman-syntax. Any advice @bhollis ?
Hey @bhollis, I'd also be interested in what @realityking is trying to do. I'd rather not have to put <?php
at the start of every code example as a lot of the time that's not actually valid for the code im trying to display.
How can I pass the start_inline
option to the lexer? I tried:
activate :syntax, wrap: true, lexer_options: { php: { start_inline: true} }
Didn't work 💨
Yeah I got exactly that far and then gave up 😞
https://github.com/middleman/middleman-syntax/blob/master/lib/middleman-syntax/extension.rb#L15 makes it look like this should work. Have you tried this:
activate :syntax, wrap: true, lexer_options: { start_inline: true }
If that doesn't work, what would really help would be a PR to add a failing test case for this situation to this repo.
If you're using fenced code blocks you can use:
```php?start_inline=1
I haven't been able to get the lexer_options
to work yet.
Is there a way to highlight PHP codeblocks without having
<?php
at the beginning of the file? I'm usingcode
ERB function. At least GitHub's code blocks allow this behaviour and it's pretty useful for tutorials when not listing a full php file.