lsegal / yard

YARD is a Ruby Documentation tool. The Y stands for "Yay!"
http://yardoc.org
MIT License
1.94k stars 397 forks source link

Generating docs with Markdown complains about encoding #459

Closed sarahhodne closed 12 years ago

sarahhodne commented 12 years ago

When I try to generate documentation with markdown markup, this happens:

% yardoc -m markdown      
[error]: Exception occurred while generating 'ContextIO/Account.html'
[error]: TypeError: Input must be UTF-8 or US-ASCII, ASCII-8BIT given
[error]: Stack trace:
    /Users/dvyjones/.rvm/gems/ruby-1.9.3-p0/gems/redcarpet-2.0.1/lib/redcarpet.rb:70:in `render'
    /Users/dvyjones/.rvm/gems/ruby-1.9.3-p0/gems/redcarpet-2.0.1/lib/redcarpet.rb:70:in `to_html'
    /Users/dvyjones/.rvm/gems/ruby-1.9.3-p0/gems/yard-0.7.4/lib/yard/templates/helpers/html_helper.rb:68:in `html_markup_markdown'
    /Users/dvyjones/.rvm/gems/ruby-1.9.3-p0/gems/yard-0.7.4/lib/yard/templates/helpers/html_helper.rb:41:in `htmlify'
    /Users/dvyjones/.rvm/gems/ruby-1.9.3-p0/gems/yard-0.7.4/templates/default/docstring/html/text.erb:3:in `_erb_cache_20'
    /Users/dvyjones/.rvm/gems/ruby-1.9.3-p0/gems/yard-0.7.4/lib/yard/templates/template.rb:238:in `erb'

Files:          26
Modules:         6 (    1 undocumented)
Classes:        19 (    1 undocumented)
Constants:       8 (    1 undocumented)
Methods:        25 (    3 undocumented)
 89.66% documented

I've tried to pass in --charset=UTF-8 and --charset UTF-8, I've tried using the LANG environment variable mentioned in the docs somewhere, I've tried doing RUBYOPT="-EUTF-8:UTF-8", but nothing seems to be working.

% ruby --version
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin11.2.0]
% yard --version
yard 0.7.4
sarahhodne commented 12 years ago

Oh, and it works fine without -m markdown, but without Markdown.

lsegal commented 12 years ago

Have you tried redcarpet 1.x? 2.x isn't yet readily compatible with YARD (it was released after 0.7.4 and contains incompatible API changes)

sarahhodne commented 12 years ago

It works perfectly now, thank you!

lsegal commented 12 years ago

FYI I've opened tanoku/redcarpet#101 to track this issue with redcarpet.