code block with ``` in markdown
renajohn opened this issue · 19 comments
Hi,
Is it possible to enable the code blocks:
My code
thanks
not yet possible, but support for that is planned.
Thanks for your answer. Looking forward to having that feature.
I implemented this on the feature/github-flavored-markdown
branch.
I don't think it's good for a release yet, but do you want to give it a try?
It requires pygmentize
to be installed.
(Windows support is pending, I'll probably need to swap over to open4
to support Windows).
It's not quite there yet. When I try to render the code bellow, all lines are included in the block and the two that should be are appended (the \n is removed). Please, ignore the backslash in front of the code block, I had to include it to prevent github from creating a code block in the comment.
This line is not in a block
\```
this is in the block
that line too
\```
but not that one
Oh oops, I think I misunderstood what you wanted :)
Right now, this syntax is supported (Using Ruby as an example language):
```ruby
… some ruby code
```
I completely forgot about the most simple case of ``` blocks.
I can implement that and probably should ;)
Do you prefer that syntax over the four-space indentation?
I hope I can get some free time tonight to take a stab at this. I only had a one hour to write the parser, and i can't say it's a piece of code I like one bit, so that's why I held off merging to master
.
Oh.. I see... that's a neat addition.
Back to the space versus tick notation, there is mainly 2 things I don't
like with 4 spaces indentations:
- It get harder to copy and past code/commands directly from the wiki
source. You have to remove the spaces before using the code. - If you have a list of item and want to put a block in between 2 bullets,
you have to add 8 spaces and not 4.
When I try Hammer with the code you've included in your message, I got the
following error:
Error detected while processing function Hammer:
line 18:
NoMethodError: undefined method `flush' for #Object:0x000001028abb20
Press ENTER or type command to continue
On Tue, Jun 21, 2011 at 4:32 PM, robgleeson <
reply@reply.github.com>wrote:
Oh oops, I think I misunderstood what you wanted :)
Right now, this syntax is supported (Using Ruby as an example language):some ruby codeI completely forgot about the most simple case of ``` blocks.
I can implement that and probably should ;)
Do you prefer that syntax over the four-space indentation?I hope I can get some free time tonight to take a stab at this. I only had
a one hour to write the parser, and i can't say it's a piece of code I like
one bit, so that's why I held off merging tomaster
.Reply to this email directly or view it on GitHub:
https://github.com/robgleeson/hammer.vim/issues/19#issuecomment-1410705
Good points!
Hm, that's an odd one.
What version of Ruby are you using? (you can check with :ruby p RUBY_DESCRIPTION
)
"ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-darwin10.6.0]"
On Tue, Jun 21, 2011 at 4:49 PM, robgleeson <
reply@reply.github.com>wrote:
Good points!
Hm, that's an odd one.
What version of Ruby are you using? (you can check with:ruby p RUBY_DESCRIPTION
)Reply to this email directly or view it on GitHub:
https://github.com/robgleeson/hammer.vim/issues/19#issuecomment-1410837
Hm, OK.
I've seen a few people have a problem or two when using Ruby 1.9 and vim
. This looks unrelated to those problems, though.
I'll build vim
against Ruby 1.9 over the coming days and see what I can discover.
I'll make sure this issue is solved or understood before merging the branch.
renajohn,
Sorry for the late reply.
Can you pull from feature/github-flavored-markdown
when you get a chance?
Are you still getting the NoMethodError
?
If not, does the ``` style block work for you?
It could be my bad karma, but it's still not working for me. I have this error:
Error detected while processing function Hammer:
line 18:
NoMethodError: undefined method `flush' for #Object:0x000001010e0518
Hm, OK.
I'm not sure where that error is coming from, but i'd guess it is being caused at a lower level and has something to do with Ruby(most likely 1.9) and Vim. If you can, I'd love to see the results against 1.8(which my vim is built against)
I've tested your code with the system default ruby version and it works. Any plan for supporting ruby 1.9? Do you know which version of Ruby comes with OS X lion?
Thanks for all your effort, I really appreciate it and I'm sure I'm not the only one!
Renault
Thanks!
I'm unsure what version of Ruby OSX Lion is going to ship with.
I'd love to support 1.9, but the problem appears to lie within vim support for 1.9.
I guess now we know Lion ships with Ruby 1.8 :(
I use MacVim installed via Homebrew, built against Ruby 1.9 which I manage with rbenv.
Hammer's master branch works fine, as do other ruby-integrated plugins like Command-T, but this GFM feature branch is giving me that same error:
Error detected while processing function Hammer:
line 18:
NoMethodError: undefined method `flush' for #<Object:0x007f9ce287f038>
Any new ideas about what's going on?
No idea, nope. :(
Hello guys, i f**ck this error, i work for kill this bug in my old project - vimscript writen in ruby, but this so much hardcore. This bug appears when script calling some Kernel
methods. For example call:
:ruby p `ls`
from vim. This work in 1.8, but in 1.9 this return same error. Sorry for my bad english.
Beautiful :)
Works nicely for the zero-indent triple-backtick ruby block I tried it with.
Thanks @robgleeson and @iflo0