-
-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nagative aurument in converter.rb:417 #12
Comments
I get this too, @fish1928. I can reproduce the error with your README.md file. The line has moved to 428 at this point, but the error is the same. I can make it run successfully (though not good looking because of wrapping lines) with This file (README-gson.md.txt) requires a minimum screen width of 75. |
I need more info on this. Both test files listed are working for me at any width screen.
|
Also, if the error is on line 428, I'm assuming you don't have pygments (pygmentize) installed? |
Not as a solution (because it truncates every line), but as insight into the problem: Essentially it takes the screen width, subtracts 3, and truncates every line to that length before piping the output to mdless. Why does this prevent the error? Codeblocks (lines between pairs of
|
Immediately upon installing
@ttscoff I can confirm that Version / terminal config$ mdless --version; ruby --version; echo -e "TERM=$TERM\nCOLUMNS=$COLUMNS";
mdless 0.0.10
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15]
TERM=xterm-256color
COLUMNS=123 |
I got a workaround by modifying that line:
to
I think it is not necessary to fill each line with spaces. |
I'm having the same issue, and can confirm that the above workaround works for me. |
works for me as well. thanks a lot! |
It is still there, I can reproduce it by putting a string of 253 characters into a code block. Anything up to 253 works fine, the 253rd character tips it over.
The problem is caused by |
jinyuj-m01:cloudml-dist-mnist-example jinyuj$ mdless /Users/jinyuj/Workspace/tensorflow/cloudml-dist-mnist-example/README.md
'/Users/jinyuj/.rvm/gems/ruby-2.3.0/gems/mdless-0.0.9/lib/mdless/converter.rb:417:in
*': negative argument (ArgumentError) from /Users/jinyuj/.rvm/gems/ruby-2.3.0/gems/mdless-0.0.9/lib/mdless/converter.rb:417:in
block (2 levels) in convert_markdown'from /Users/jinyuj/.rvm/gems/ruby-2.3.0/gems/mdless-0.0.9/lib/mdless/converter.rb:413:in
map' from /Users/jinyuj/.rvm/gems/ruby-2.3.0/gems/mdless-0.0.9/lib/mdless/converter.rb:413:in
block in convert_markdown'from /Users/jinyuj/.rvm/gems/ruby-2.3.0/gems/mdless-0.0.9/lib/mdless/converter.rb:393:in
gsub!' from /Users/jinyuj/.rvm/gems/ruby-2.3.0/gems/mdless-0.0.9/lib/mdless/converter.rb:393:in
convert_markdown'from /Users/jinyuj/.rvm/gems/ruby-2.3.0/gems/mdless-0.0.9/lib/mdless/converter.rb:117:in
block in initialize' from /Users/jinyuj/.rvm/gems/ruby-2.3.0/gems/mdless-0.0.9/lib/mdless/converter.rb:105:in
each'from /Users/jinyuj/.rvm/gems/ruby-2.3.0/gems/mdless-0.0.9/lib/mdless/converter.rb:105:in
initialize' from /Users/jinyuj/.rvm/gems/ruby-2.3.0/gems/mdless-0.0.9/bin/mdless:17:in
new'from /Users/jinyuj/.rvm/gems/ruby-2.3.0/gems/mdless-0.0.9/bin/mdless:17:in
<top (required)>' from /Users/jinyuj/.rvm/gems/ruby-2.3.0/bin/mdless:23:in
load'from /Users/jinyuj/.rvm/gems/ruby-2.3.0/bin/mdless:23:in
<main>' from /Users/jinyuj/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in
eval'from /Users/jinyuj/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `
So, the problem is that in line 417, the code use a nagative number * a string, commonly, "ha"*3 means we will get "hahaha" as the result. But if the number is a nagetive number, there will be an error of it. The problem is that in line 417, the (@cols - orig_length) get an nagetive number when I am using this. please help to figure this out : )
README.md.txt
The text was updated successfully, but these errors were encountered: