Skip to content
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

Spaces inserted into code #109

Closed
josephzidell opened this issue Feb 4, 2014 · 16 comments
Closed

Spaces inserted into code #109

josephzidell opened this issue Feb 4, 2014 · 16 comments

Comments

@josephzidell
Copy link

Using

    pipeline = HTML::Pipeline.new [
      HTML::Pipeline::MarkdownFilter,
      HTML::Pipeline::SyntaxHighlightFilter
    ]

produces code that has 10 spaces prepended to every line after the first, including an extra line with 10 spaces at the end.

This

```css
@media (max-width: 992px) {
    #contact_email{ display: none; }
}

produces

@media (max-width: 992px) {
              #contact_email{ display: none; }
          }
          // 10 spaces at end
@simeonwillbanks
Copy link
Contributor

Hi @josephzidell!

Please gist your raw markdown document, so I can try to reproduce. Thanks.

@josephzidell
Copy link
Author

@simeonwillbanks
Copy link
Contributor

@josephzidell I'm sorry, but I don't see the extra white space. It's not in your gist. I created a testing gist, and the CSS looks good. Maybe, your implementation is adding the white space?

@josephzidell
Copy link
Author

@simeonwillbanks Thanks for your help. How would I determine if my "implementation" is adding the white space?

@simeonwillbanks
Copy link
Contributor

@josephzidell Let's try a few things:

  1. Double check your CSS styles; is a padding or a margin being added?
  2. Add result[:output].to_s to your gist
  3. Run bundle exec nokogiri -v and paste output into this issue
  4. Paste more relevant implementation code into this issue

Thanks!

@josephzidell
Copy link
Author

@simeonwillbanks Thanks so much for your help. I trimmed down the problem to just a single line.

  1. It's actual spaces, highlightable via a mouse

  2. Here's a new gist with everything.

  3. nokogiri version

    $ bundle exec nokogiri -v

    Nokogiri (1.6.1)

    ---
    warnings: []
    nokogiri: 1.6.1
    ruby:
      version: 2.0.0
      platform: x86_64-linux
      description: ruby 2.0.0p353 (2013-11-22 revision 43784) [x86_64-linux]
      engine: ruby
    libxml:
      binding: extension
      source: packaged
      libxml2_path: /home/wwc/.rvm/gems/ruby-2.0.0-p353/gems/nokogiri-1.6.1/ports/x86_64-linux-gnu/libxml2/2.8.0
      libxslt_path: /home/wwc/.rvm/gems/ruby-2.0.0-p353/gems/nokogiri-1.6.1/ports/x86_64-linux-gnu/libxslt/1.1.26
      compiled: 2.8.0
      loaded: 2.8.0
    
  4. That's it!

@simeonwillbanks
Copy link
Contributor

@josephzidell Thanks for the info, but I'm still unable to reproduce.

Your markdown is sent to GitHub::Markdown. Maybe it's the source of the issue? Please try this in your rails console:

markdown = @post.body_markdown
pipeline = HTML::Pipeline.new [HTML::Pipeline::MarkdownFilter]
pipeline.call(markdown)[:output].to_s
#=> "<pre lang=\"html\"><code>&lt;a href=&quot;mailto:[email protected]?subject=Hi!&amp;amp;amp;body=Either type the email address or use the form. Thanks!&quot;&gt;&lt;/a&gt;\n</code></pre>" 
GitHub::Markdown.to_html(markdown, :gfm)
#=> "<pre lang=\"html\"><code>&lt;a href=&quot;mailto:[email protected]?subject=Hi!&amp;amp;amp;body=Either type the email address or use the form. Thanks!&quot;&gt;&lt;/a&gt;\n</code></pre>\n" 

@jch
Copy link
Contributor

jch commented Feb 26, 2014

Closing from inactivity. Feel free to re-open if you still need help.

@jch jch closed this as completed Feb 26, 2014
@josephzidell
Copy link
Author

This is still an issue, that I'd like to get fixed.

Due to the length of time here, I actually implemented the web app in PHP instead of rails :( to get around this problem.

Followed @simeonwillbanks's instructions: no extra spaces there.

@simeonwillbanks
Copy link
Contributor

@josephzidell If you tried my two examples and you didn't see extra spaces, it sounds like html-pipeline isn't the culprit. Maybe the issue is with raw?

@josephzidell
Copy link
Author

After some playing around, the issue certainly seems to be with raw. So it's not an issue with html-pipeline.

The question is: what to do?

@jch
Copy link
Contributor

jch commented Feb 27, 2014

@josephzidell you might want to try your question over at stackoverflow.com too

@simeonwillbanks
Copy link
Contributor

@josephzidell I second trying on stackoverflow.com.

@josephzidell
Copy link
Author

Will do. Thanks, guys. Here's a link to the question. Thanks, guys!

@josephzidell
Copy link
Author

As you can see, it's actually a HAML issue. Thanks again.

@simeonwillbanks
Copy link
Contributor

Good to know. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants