GithubHelp home page GithubHelp logo

middleman / middleman-syntax Goto Github PK

View Code? Open in Web Editor NEW
179.0 9.0 57.0 95 KB

Code syntax highlighting plugin via Rouge for Middleman

Home Page: https://middlemanapp.com

License: MIT License

Ruby 60.04% Gherkin 26.70% HTML 1.72% Haml 2.38% Slim 1.57% Dockerfile 7.59%
middleman-extension code-highlight syntax-highlighting

middleman-syntax's Introduction

Middleman - Makes developing websites simple

Gem Version CI License

Middleman is a static site generator using all the shortcuts and tools in modern web development. Check out middlemanapp.com for detailed tutorials, including a getting started guide.

Why Middleman?

These days, many websites are built with an API in mind. Rather than package the frontend and the backend together, both can be built and deployed independently using the public API to pull data from the backend and display it on the frontend. Static websites are incredibly fast and require very little RAM. A front-end built to stand-alone can be deployed directly to the cloud or a CDN. Many designers and developers simply deliver static HTML/JS/CSS to their clients.

  • Uses Sass for DRY stylesheets.
  • Bring your own asset pipeline (WebPack, Babel, Sprockets or any other).
  • Easy templating with ERb or Haml.

Middleman gives the stand-alone developer access to all these tools and many, many more.

Installation

Middleman is built on Ruby and uses the RubyGems package manager for installation. These are usually pre-installed on Mac OS X and Linux. Windows users can install both using RubyInstaller. For windows RubyInstaller-Devkit is also required.

gem install middleman

Getting Started

Once Middleman is installed, you will have access to the middleman command. First, let's create a new project. From the terminal:

middleman init MY_PROJECT

This will create a new Middleman project located in the "MY_PROJECT" directory. This project contains a config.rb file for configuring Middleman and a source directory for storing your pages, stylesheets, javascripts and images.

Change directories into your new project and start the preview server:

cd MY_PROJECT
middleman server

The preview server allows you to build your site, by modifying the contents of the source directory, and see your changes reflected in the browser at: http://localhost:4567/

To get started, simply develop as you normally would by building HTML, CSS, and Javascript in the source directory. When you're ready to use more complex templates, simply add the templating engine's extension to the file and start writing in that format.

For example, say I am working on a stylesheet at source/stylesheets/site.css and I'd like to start using Compass and Sass. I would rename the file to source/stylesheets/site.css.scss and Middleman will automatically begin processing that file as Sass. The same would apply to CoffeeScript (.js.coffee), Haml (.html.haml) and any other templating engine you might want to use.

Finally, you will want to build your project into a stand-alone site. From the project directory:

middleman build

This will compile your templates and output a stand-alone site which can be easily hosted or delivered to your client. The build step can also compress images, employ Javascript & CSS dependency management, minify Javascript & CSS and run additional code of your choice. Take a look at the config.rb file to see some of the most common extensions which can be activated.

Learn More

A full set of in-depth instructional guides are available on the official website at: http://middlemanapp.com.

Additionally, up-to-date generated code documentation is available on RubyDoc.

Community

The official community forum is available at: http://forum.middlemanapp.com

Bug Reports

Github Issues are used for managing bug reports and feature requests. If you run into issues, please search the issues and submit new problems: https://github.com/middleman/middleman/issues

The best way to get quick responses to your issues and swift fixes to your bugs is to submit detailed bug reports, include test cases and respond to developer questions in a timely manner. Even better, if you know Ruby, you can submit Pull Requests containing Cucumber Features which describe how your feature should work or exploit the bug you are submitting.

How to Run Cucumber Tests

  1. Checkout Repository: git clone https://github.com/middleman/middleman.git
  2. Install Bundler: gem install bundler
  3. Run bundle install inside the project root to install the gem dependencies.
  4. Run test cases: bundle exec rake test

Donate

Click here to lend your support to Middleman

Versioning

This library aims to adhere to Semantic Versioning 2.0.0. Violations of this scheme should be reported as bugs. Specifically, if a minor or patch version is released that breaks backward compatibility, that version should be immediately yanked and/or a new version should be immediately released that restores compatibility. Breaking changes to the public API will only be introduced with new major versions. As a result of this policy, you can (and should) specify a dependency on this gem using the Pessimistic Version Constraint with two digits of precision. For example:

gem 'middleman', '~> 4.0'

License

Copyright (c) 2010-2023 Thomas Reynolds. MIT Licensed, see LICENSE for details.

middleman-syntax's People

Contributors

36degrees avatar airblade avatar alexkunger avatar arcovion avatar bhollis avatar cpence avatar di avatar gabebw avatar karlfreeman avatar leonb avatar markets avatar maxlap avatar naberon avatar southpolesteve avatar tarky avatar tdreyno avatar tuomasj avatar unity avatar zoltan-nz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

middleman-syntax's Issues

Line numbers not working

I've configured things as per the README:

require 'redcarpet'
set :markdown_engine, :redcarpet
set :markdown, hard_wrap: true, fenced_code_blocks: true, smartypants: true
activate :syntax, linenos: 'inline', anchorlinenos: true, linenostart: 2

My blog article has this:

```ruby
def my_cool_method(message)
  puts message
end
```

The result is correctly syntax-highlighted but there aren't any line numbers.

I'm using middleman-syntax 1.2.1, rouge 0.3.10, middleman-blog 3.2.0, redcarpet 3.0.0.

Using clipboard.js

Hi, I am using middleman 4, kramdown and middleman-syntax latest.

I am looking for a way to use https://clipboardjs.com/ in my middleman pages. But this requires that
the non-highlighted code syntax is present somewhere.

While when using middleman-syntax

In my documentation.md I have:

Some code example:

```js
  code code code
```

Which is then turned to:

<p>Some code example:</p>

<div class="...">
  <span>code</span> <span class="..">code</span> <!-- etc... -->
</div>

So I cannot bind clipboard.js to the code example because the content is split for good, for syntax highlighting.

I would like to use the clipboard.js system to provide copy/paste on the code sample.

I am very new to middleman/ruby and I am sure this is not exactly the right place to ask this. But do you have some pointers for me?

Thanks.

Syntax highlighting to proxy generated pages

I'm generating blog pages using the Contentful Middleman gem, within these yaml files I have Markdown content that I pass through a markdown renderer with code blocks

  def markdown(content)
    Tilt['markdown'].new { content }.render(scope=self)
  end

And a typical yaml file including a code block in the body (ignore my single quotes around the code block, I just couldn't get it to render on here otherwise!)


---
:id: 
:title: Wordpress Multisite sub-domains with Pow & Apache
:slug: wordpress-multisite-sub-domains-with-pow-apache
:author:
- :id: 
  :name: Ollie Kavanagh
:body: |-
  I have my local dev environment set up with Pow and I then make Apache listen on Port 81 for any PHP apps I'm doing on `.dev`. I'm currently working on a Wordpress Sub-domain multisite yet I was stumped as the sub-domain alias wasn't working for me locally using the following...

' ```
  <Directory "/Users/olliekav/Sites/">
    AllowOverride All
    Require all granted
  </Directory>

  <VirtualHost 127.0.0.1:81>
    ServerName any.dev
    ServerAlias *.dev
    VirtualDocumentRoot "/Users/olliekav/Sites/%1"
  </VirtualHost>
  ```'

And I generate these files via proxy...

app.data.blog.articles.each do |article|
  proxy "/blog/#{article[1][:slug]}/index.html", "/blog/show.html", locals: { 
    article: article[1]
  }, :ignore => true
end

set :markdown_engine, :redcarpet
set :markdown, smartypants: true, fenced_code_blocks: true

activate :syntax, line_numbers: true

Middleman-syntax has a lot of trouble picking up the code blocks form within these pages generated via proxy. Some blocks won't even format and it never gets line numbers. Any ideas?

Syntax highlighting not playing well with Slim

A bit of context: I'm creating a styleguide using Middleman + Slim + Sass + a few other goodies. Latest versions of each and I'm on a Mac. I've been tinkering with Middleman Syntax and it seems like it doesn't play well with Slim (or Slim doesn't play well with Middleman Syntax).

I've created a simple demo site to demonstrate the issues that I'm seeing http://bpainter.github.io/slim-middleman-syntax-tests/.

The repo for the demo site is also on Github. https://github.com/bpainter/slim-middleman-syntax-tests

The only way that I've found to get the syntax highlighting to work correctly is to place the code helper with the code I want to highlight in either an .erb or .md partial and render that on my main page.

The slim files are in the repo above, but for good measure here's the various ways I'm rendering the code helper.

/ :(
- code("html")
  <div class="field">
    <label for="basic-input">Basic Input Label</label>
    <input type="text" id="basic-input" name="basic-input" size="40" placeholder="Placeholder Text" />
  </div>

/ :(
erb:
  <% code("html") do %>
    <div class="field">
      <label for="basic-input">Basic Input Label</label>
      <input type="text" id="basic-input" name="basic-input" size="40" placeholder="Placeholder Text" />
    </div>
  <% end %>

/ :(
markdown:
  ```html
  <div class="field">
    <label for="basic-input">Basic Input Label</label>
    <input type="text" id="basic-input" name="basic-input" size="40" placeholder="Placeholder Text" />
  </div>

Partials

/ :(
== partial "code-example-1"

/ :)
== partial "code-example-2"  

/ :)
== partial "code-example-3"  

code-example-1.slim

- code("html")
  <div class="field">
    <label for="basic-input">Basic Input Label</label>
    <input type="text" id="basic-input" name="basic-input" size="40" placeholder="Placeholder Text" />
  </div>

code-example-2.erb

<% code("html") do %>
<div class="field">
  <label for="basic-input">Basic Input Label</label>
  <input type="text" id="basic-input" name="basic-input" size="40" placeholder="Placeholder Text" />
</div>
<% end %>

code-example-3.md

```html
<div class="field">
  <label for="basic-input">Basic Input Label</label>
  <input type="text" id="basic-input" name="basic-input" size="40" placeholder="Placeholder Text" />
</div>

Empty language block bug

I seem to have inadvertently found a bug while trying out the latest kramdown supporting middleman syntax. Having a code block in a post without a language specified throws an error:

get_lexer_by_name raise ClassNotFound('no lexer for alias %r found' % _alias) ClassNotFound: no lexer for alias 'plain' found

e.g.

.hello {
float: left;
}

produces an error, while providing it with a language,

.hello {
float: left;
}

does not.

block doesn't play well with haml

I'm working on a site using middleman (very excited about it btw, only found it yesterday!), and I'd like to add syntax highlighting. I'm working in haml, and found the

<% code("ruby") do %>
def my_cool_method(message)
  puts message
end
<% end %>

when translated directly to haml

- code("ruby") do
  def my_cool_method(message)
    puts message
  end

causes problems because of the whitespace. I played around with it a bit and found that prefixing the code with :plain makes everything play nicely (much thanks to this Google group)

- code("ruby") do
  :plain
    def my_cool_method(message)
      puts message
    end

Would it be possible to check if the user is working with haml and then add the :plain prefix automatically? Perhaps something like what's happening for kramdown? I'm not sure I'm reading that code correctly though...

In Kramdown, fenced code blocks no longer accept inline attribute lists

In Kramdown, Inline Attribute Lists allow for this:

  ~~~ruby
  puts("hello world")
  ~~~
  {: data-title="Some ruby"}

Which results in the code block adopting those attributes. Here's the result using the standard syntax highlighter option and setting it to CodeRay, and not activating middleman-syntax:

  <div data-title="Some ruby" class="highlighter-coderay"><div class="CodeRay">
    <div class="code"><pre>puts(...)
  </pre></div>
  </div>
  </div>

Currently using Middleman 4.0...don't know if that would make any difference

How can I pass options to pygments?

I would like pygments to show line numbers. I can't find a way to pass 'linenos=True' to pygments in config.rb.

I don't think this is possible at the moment. It would be nice if this could be implemented.

undefined method `markdown_engine' for Middleman::Application::MiddlemanApplication1:Class

Hey guys, I'm getting a really weird error trying to get middleman-syntax working.

Using a fresh middleman version 3.0.6.

In config.rb

activate :syntax
set :markdown_engine, :kramdown

In Gemfile

gem "middleman"
gem "kramdown"
gem "middleman-syntax"

Then running bundle exec middleman server gives:

/Users/nmurray/.rvm/gems/ruby-1.9.3-p392@intuition/gems/middleman-syntax-1.2.0/lib/middleman-syntax/extension.rb:17:in `registered': undefined method `markdown_engine' for Middleman::Application::MiddlemanApplication1:Class (NoMethodError)
    from /Users/nmurray/.rvm/gems/ruby-1.9.3-p392@intuition/gems/middleman-core-3.0.6/lib/middleman-core/core_extensions/extensions.rb:92:in `register'
    from /Users/nmurray/.rvm/gems/ruby-1.9.3-p392@intuition/gems/middleman-core-3.0.6/lib/middleman-core/core_extensions/extensions.rb:119:in `activate'
    from /Users/nmurray/projects/writing/intuition/config.rb:44:in `initialize'
    from /Users/nmurray/.rvm/gems/ruby-1.9.3-p392@intuition/gems/middleman-core-3.0.6/lib/middleman-core/core_extensions/extensions.rb:137:in `instance_eval'
    from /Users/nmurray/.rvm/gems/ruby-1.9.3-p392@intuition/gems/middleman-core-3.0.6/lib/middleman-core/core_extensions/extensions.rb:137:in `initialize'
    from /Users/nmurray/.rvm/gems/ruby-1.9.3-p392@intuition/gems/middleman-core-3.0.6/lib/middleman-core/core_extensions/ruby_encoding.rb:22:in `initialize'
    from /Users/nmurray/.rvm/gems/ruby-1.9.3-p392@intuition/gems/middleman-core-3.0.6/lib/middleman-core/core_extensions/data.rb:35:in `initialize'
    from /Users/nmurray/.rvm/gems/ruby-1.9.3-p392@intuition/gems/middleman-core-3.0.6/lib/middleman-core/application.rb:188:in `initialize'
    from /Users/nmurray/.rvm/gems/ruby-1.9.3-p392@intuition/gems/middleman-core-3.0.6/lib/middleman-core/core_extensions/request.rb:56:in `new'
    from /Users/nmurray/.rvm/gems/ruby-1.9.3-p392@intuition/gems/middleman-core-3.0.6/lib/middleman-core/core_extensions/request.rb:56:in `inst'
    from /Users/nmurray/.rvm/gems/ruby-1.9.3-p392@intuition/gems/middleman-core-3.0.6/lib/middleman-core/preview_server.rb:72:in `new_app'
    from /Users/nmurray/.rvm/gems/ruby-1.9.3-p392@intuition/gems/middleman-core-3.0.6/lib/middleman-core/preview_server.rb:155:in `mount_instance'
    from /Users/nmurray/.rvm/gems/ruby-1.9.3-p392@intuition/gems/middleman-core-3.0.6/lib/middleman-core/preview_server.rb:18:in `start'
    from /Users/nmurray/.rvm/gems/ruby-1.9.3-p392@intuition/gems/middleman-core-3.0.6/lib/middleman-core/cli/server.rb:68:in `server'
    from /Users/nmurray/.rvm/gems/ruby-1.9.3-p392@intuition/gems/thor-0.15.4/lib/thor/task.rb:27:in `run'
    from /Users/nmurray/.rvm/gems/ruby-1.9.3-p392@intuition/gems/thor-0.15.4/lib/thor/invocation.rb:120:in `invoke_task'
    from /Users/nmurray/.rvm/gems/ruby-1.9.3-p392@intuition/gems/thor-0.15.4/lib/thor.rb:275:in `dispatch'
    from /Users/nmurray/.rvm/gems/ruby-1.9.3-p392@intuition/gems/thor-0.15.4/lib/thor/base.rb:425:in `start'
    from /Users/nmurray/.rvm/gems/ruby-1.9.3-p392@intuition/gems/middleman-core-3.0.6/lib/middleman-core/cli.rb:77:in `method_missing'
    from /Users/nmurray/.rvm/gems/ruby-1.9.3-p392@intuition/gems/thor-0.15.4/lib/thor/task.rb:29:in `run'
    from /Users/nmurray/.rvm/gems/ruby-1.9.3-p392@intuition/gems/thor-0.15.4/lib/thor/task.rb:126:in `run'
    from /Users/nmurray/.rvm/gems/ruby-1.9.3-p392@intuition/gems/thor-0.15.4/lib/thor/invocation.rb:120:in `invoke_task'
    from /Users/nmurray/.rvm/gems/ruby-1.9.3-p392@intuition/gems/thor-0.15.4/lib/thor.rb:275:in `dispatch'
    from /Users/nmurray/.rvm/gems/ruby-1.9.3-p392@intuition/gems/thor-0.15.4/lib/thor/base.rb:425:in `start'
    from /Users/nmurray/.rvm/gems/ruby-1.9.3-p392@intuition/gems/middleman-core-3.0.6/lib/middleman-core/cli.rb:22:in `start'
    from /Users/nmurray/.rvm/gems/ruby-1.9.3-p392@intuition/gems/middleman-core-3.0.6/bin/middleman:18:in `<top (required)>'
    from /Users/nmurray/.rvm/gems/ruby-1.9.3-p392@intuition/bin/middleman:19:in `load'
    from /Users/nmurray/.rvm/gems/ruby-1.9.3-p392@intuition/bin/middleman:19:in `<main>'
    from /Users/nmurray/.rvm/gems/ruby-1.9.3-p392@intuition/bin/ruby_noexec_wrapper:14:in `eval'
    from /Users/nmurray/.rvm/gems/ruby-1.9.3-p392@intuition/bin/ruby_noexec_wrapper:14:in `<main>'

I'm a missing something obvious? Thanks!

haml 6 support

middlean-syntax 3.3.0 does not support for haml 6.0.0.beta.2.

A combination of haml 6.0.0.beta.2 and middlean-syntax 3.3.0 causes errors on middleman build (maybe middleman server as wel).

Why

# If Haml is around, define a :code filter that can be used to more conveniently output highlighted code.
if defined? Haml
module Haml
module Filters
module Code
include Base

does not support haml 6 classes.

Workaround

$ git diff lib/middleman-syntax/haml_monkey_patch.rb
--- a/vendor/bundle/ruby/3.1.0/gems/middleman-syntax-3.3.0/lib/middleman-syntax/haml_monkey_patch.rb 2022-08-31 00:00:00.123456789 +0000
+++ b/vendor/bundle/ruby/3.1.0/gems/middleman-syntax-3.3.0/lib/middleman-syntax/haml_monkey_patch.rb 2022-08-31 00:00:00.123456789 +0000
@@ -1,8 +1,9 @@
 # If Haml is around, define a :code filter that can be used to more conveniently output highlighted code.
 if defined? Haml
   module Haml
-    class Filters
-      class Code < Base
+    module Filters
+      module Code
+        include Base
 
         def render(code)
           code = code.rstrip

Problem with highlighting code containing Erb

Hi, I've been writing blog posts in Middleman as .md files. Now I have a helper that I need to use in posts, so I'm converting to .md.erb.

When there is Erb code in a syntax highlighting block however, the engine wants to evaluate it and page rendering fails (eg with "undefined method `each' for nil:NilClass"):

<% code("erb") do %>
<!-- app/views/posts/index.html.erb -->
<ul>
  <% @posts.each do |post| %> <<<< error
    <li>
      <%= post.title %><br />
      <%= post.content %>
    </li>
  <% end %>
<ul>
<% end %>

This is my current Middleman config.rb: https://gist.github.com/markoa/6534662

If you have any idea what I'm doing wrong, please help.

support of syntax highlight (lisp, console, template languages)

Hi! Recently I began work with middleman and I use middleman-syntax. Hmm... I see some problem here, maybe you known how I may solve them?

For example, I write following code block:


~~~lisp
some code
~~~ 

but this code no have syntax highlight, it just plain text. The same with css+erb and html+django blocks. I used jekyll before (with redcarpet and pygments.rb) and all was right.

Version incompatibility with pygments.rb (0.3.x)

Error when attempting to install via rubygems:

Bundler could not find compatible versions for gem "pygments.rb":
In Gemfile:
middleman-syntax (>= 0) ruby depends on
  pygments.rb (~> 0.2.13) ruby

pygments.rb (0.3.1)

PHP code block without `<?php`

Is there a way to highlight PHP codeblocks without having <?php at the beginning of the file? I'm using code 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.

Disable Line Numbers in RSS Feed

I like enabling the line numbers, but I just realized that they don't work in my RSS feed. They just appear above the entire code snippet.

Is there any way to hide them in certain contexts like this?

Is it possible to use this in Markdown?

For example: in a MD file, this renders literally.

<% code("ruby") do %>
def my_cool_method(message)
  puts message
end
<% end %>

Is there any way to compile it as if it were in HTML?

New release

Can you push a new gem to Rubygems that doesn't require the existence of middleman-more?

Generates bad highlighting

Hi

I just tested this gem and it works quite bad for me.

Gemfile:
gem "middleman-syntax"
gem "redcarpet"

config.rb:
###
# Markdown
###

set :markdown_engine, :redcarpet
set :markdown, :fenced_code_blocks => true, :smartypants => true

###
# Code highlighting
###

activate :syntax

Then I use it in a .md file like this:

  ```ruby
    def index
      @cars = Car.all

      respond_to do |format|
        format.html # index.html.erb
        format.json { render json: @cars }
      end
    end

    # GET /cars/1
    # GET /cars/1.json
    def show
      @car = Car.find(params[:id])

      respond_to do |format|
        format.html # show.html.erb
        format.json { render json: @car }
      end
    end
  // I have end backticks here but I can't add them because it messes up github

It seems to highlight the code pretty bad. The output can be seen here:
https://gist.github.com/Linuus/5130247

It gets error on # and pretty much only n, p and o classes otherwise.

Did I do anything wrong?

Use format string for CSS class

Currently the chosen CSS class is automatically concatenated with the lexer.tag here:
https://github.com/middleman/middleman-syntax/blob/master/lib/middleman-syntax/highlighter.rb#L11

I'm thinking a more flexible approach would be to use a format string (same style as middleman-blog):

css_class: 'highlight {lang}'  # Current default, must now specify {lang} as well
css_class: '{lang}'  # No class
css_class: 'highlight'  # Omitting the language class, currently not possible
css_class: 'highlight language-{lang}'  # Prefix, currently not possible

Also I noticed passing false is coerced to a string due to the line I linked, I think it should behave as nil OR both nil and false should raise errors.

The HTML5 working draft suggests this prefix idea which is why I added it. Previously I thought of just concatenating the two without a space if the css_class ends with a dash - but using a format string seems cleaner and means you wouldn't need another option to turn the language class off.

What do you think? It's a breaking change, so maybe adding another option like use_format_string: true would be needed? Will write the PR if this feature is accepted.

Lexer options don't get passed to lexer

Lexer options, defined in config.rb don't seem to get passed to passed to the lexer:

activate :syntax, lexer_options: { prompt: '$,#,;' }

The above doesn't actually override the default settings of the console lexer.

I've been trying to figure out what was going on and it seems like the lexer_options need to be passed as the third argument to find_fancy, rather than to lexer.lex (in https://github.com/middleman/middleman-syntax/blob/master/lib/middleman-syntax/highlighter.rb):

def self.highlight(code, language=nil, opts={})
  highlighter_options = options.to_h.merge(opts)
  formatter = Middleman::Syntax::Formatters::HTML.new(highlighter_options)
  lexer_options = highlighter_options.delete(:lexer_options)
  
  lexer = Rouge::Lexer.find_fancy(language, code, lexer_options) || Rouge::Lexers::PlainText
  
  highlighter_options[:css_class] = [ highlighter_options[:css_class], lexer.tag ].join(' ')
  
  formatter.format(lexer.lex(code, lexer_options))
end

Indentation problem with fenced code blocks in Markdown - but not HAML

I've just found #16 - which shows the symptom I have exactly. However it (as well as a fair few other hits on the net) all end up being about how HAML is doing the indenting - and the fix seems to be haml config.

However - I'm not using haml.

My content files are title.html.md.erb

Config for markdown er

set :markdown, :fenced_code_blocks => true, :smartypants => true

Markdown engine is kramdown (1.3.3). Have also tested with redcarpet 3.1.1.

What I see is that if there are two or more lines in a fenced code section (see e.g. this source document - for both ruby and sql blocks) then in the built HTML I see nicely indented HTML generated from the markdown - which of course breaks the code layout by adding those spaces when inside a pre block. The example article renders like this

I'd appreciate any ideas on how to fix this :)

Rails 4..

I get this error running gem install:
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies...
Bundler could not find compatible versions for gem "activesupport":
In Gemfile:
middleman-syntax (>= 0) ruby depends on
activesupport (~> 3.2.6) ruby

carrierwave (>= 0) ruby depends on
  activesupport (4.0.2)

Process finished with exit code 6
Any Idea?

sorry my fault.. error

middleman-syntax enablement crashes server

I have a middleman app (https://github.com/whitlockjc/thoughtspark.org) and it will generate my website perfect but if I try to run the local server and access /node/26, the server will crash and I get an error report on OS X. To reproduce:

  • Clone the repository at the link above
  • Install middleman/ruby dependencies for the project
  • Update the config.rb to activate middleman-syntax by default (As my comment below says, I've disabled middleman-syntax by default for the local server to actually allow me to test my website.)
  • Run middleman
  • Visit http://localhost:4567/node/26/

You'll see that the server sends an empty response and the server dies. Below is my crash report (I'm using RVM and Ruby 1.9.x, 'x' because I tried this with 1.9.2 and 1.9.3). Also, if you disable the syntax extension, everything runs properly. I'm not sure if the issue with middleman-syntax or if it's related to pygments.rb but I figure if I'm running into it, others might as well. Now for the crash report:

Process:         ruby [83487]
Path:            /Users/USER/*/ruby
Identifier:      ruby
Version:         ??? (???)
Code Type:       X86-64 (Native)
Parent Process:  bash [86929]

Date/Time:       2012-11-15 15:26:54.764 -0700
OS Version:      Mac OS X 10.7.5 (11G63)
Report Version:  9

Crashed Thread:  4

Exception Type:  EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000002, 0x0000000000000000

Application Specific Information:
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
objc[83487]: garbage collection is OFF

Thread 0:: Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib          0x00007fff8cf4ddf2 __select + 10
1   libruby.1.9.1.dylib             0x000000010e901d26 rb_fd_select + 177
2   libruby.1.9.1.dylib             0x000000010e901ecf do_select + 423
3   libruby.1.9.1.dylib             0x000000010e9022f9 rb_thread_fd_select + 184
4   libruby.1.9.1.dylib             0x000000010e7e4bd1 select_internal + 1200
5   libruby.1.9.1.dylib             0x000000010e7e50ee select_call + 73
6   libruby.1.9.1.dylib             0x000000010e7b8ec7 rb_ensure + 151
7   libruby.1.9.1.dylib             0x000000010e7e540a rb_f_select + 257
8   libruby.1.9.1.dylib             0x000000010e8efce0 call_cfunc + 281
9   libruby.1.9.1.dylib             0x000000010e8efb48 vm_call_cfunc + 287
10  libruby.1.9.1.dylib             0x000000010e8eecfc vm_call_method + 370
11  libruby.1.9.1.dylib             0x000000010e8e9945 vm_exec_core + 11533
12  libruby.1.9.1.dylib             0x000000010e8f9876 vm_exec + 147
13  libruby.1.9.1.dylib             0x000000010e8fa20a rb_iseq_eval + 45
14  libruby.1.9.1.dylib             0x000000010e7baa99 rb_load_internal + 489
15  libruby.1.9.1.dylib             0x000000010e7bad09 rb_f_load + 193
16  libruby.1.9.1.dylib             0x000000010e8efce0 call_cfunc + 281
17  libruby.1.9.1.dylib             0x000000010e8efb48 vm_call_cfunc + 287
18  libruby.1.9.1.dylib             0x000000010e8eecfc vm_call_method + 370
19  libruby.1.9.1.dylib             0x000000010e8e9945 vm_exec_core + 11533
20  libruby.1.9.1.dylib             0x000000010e8f9876 vm_exec + 147
21  libruby.1.9.1.dylib             0x000000010e8f5656 eval_string_with_cref + 1011
22  libruby.1.9.1.dylib             0x000000010e8f5a3b eval_string + 72
23  libruby.1.9.1.dylib             0x000000010e8f5bc1 rb_f_eval + 388
24  libruby.1.9.1.dylib             0x000000010e8efce0 call_cfunc + 281
25  libruby.1.9.1.dylib             0x000000010e8efb48 vm_call_cfunc + 287
26  libruby.1.9.1.dylib             0x000000010e8eecfc vm_call_method + 370
27  libruby.1.9.1.dylib             0x000000010e8e9945 vm_exec_core + 11533
28  libruby.1.9.1.dylib             0x000000010e8f9876 vm_exec + 147
29  libruby.1.9.1.dylib             0x000000010e8fa249 rb_iseq_eval_main + 45
30  libruby.1.9.1.dylib             0x000000010e7b7b0b ruby_exec_internal + 193
31  libruby.1.9.1.dylib             0x000000010e7b7c2f ruby_exec_node + 30
32  libruby.1.9.1.dylib             0x000000010e7b7c02 ruby_run_node + 56
33  ruby                            0x000000010e776ee3 main + 79
34  ruby                            0x000000010e776e8c start + 52

Thread 1:
0   libsystem_kernel.dylib          0x00007fff8cf4ddf2 __select + 10
1   libruby.1.9.1.dylib             0x000000010e901d26 rb_fd_select + 177
2   libruby.1.9.1.dylib             0x000000010e901ecf do_select + 423
3   libruby.1.9.1.dylib             0x000000010e9022f9 rb_thread_fd_select + 184
4   libruby.1.9.1.dylib             0x000000010e7e4bd1 select_internal + 1200
5   libruby.1.9.1.dylib             0x000000010e7e50ee select_call + 73
6   libruby.1.9.1.dylib             0x000000010e7b8ec7 rb_ensure + 151
7   libruby.1.9.1.dylib             0x000000010e7e540a rb_f_select + 257
8   libruby.1.9.1.dylib             0x000000010e8efce0 call_cfunc + 281
9   libruby.1.9.1.dylib             0x000000010e8efb48 vm_call_cfunc + 287
10  libruby.1.9.1.dylib             0x000000010e8eecfc vm_call_method + 370
11  libruby.1.9.1.dylib             0x000000010e8e9945 vm_exec_core + 11533
12  libruby.1.9.1.dylib             0x000000010e8f9876 vm_exec + 147
13  libruby.1.9.1.dylib             0x000000010e8f8348 invoke_block_from_c + 584
14  libruby.1.9.1.dylib             0x000000010e8f84ce rb_vm_invoke_proc + 253
15  libruby.1.9.1.dylib             0x000000010e8fec65 thread_start_func_2 + 571
16  libruby.1.9.1.dylib             0x000000010e8fda27 thread_start_func_1 + 58
17  libsystem_c.dylib               0x00007fff8ab608bf _pthread_start + 335
18  libsystem_c.dylib               0x00007fff8ab63b75 thread_start + 13

Thread 2:
0   libsystem_kernel.dylib          0x00007fff8cf4dbca __psynch_cvwait + 10
1   libsystem_c.dylib               0x00007fff8ab64274 _pthread_cond_wait + 840
2   libruby.1.9.1.dylib             0x000000010e8fd6b4 native_cond_timedwait + 37
3   libruby.1.9.1.dylib             0x000000010e8fdd33 native_sleep + 298
4   libruby.1.9.1.dylib             0x000000010e8ffa9e sleep_timeval + 129
5   libruby.1.9.1.dylib             0x000000010e8ffc63 rb_thread_wait_for + 47
6   libruby.1.9.1.dylib             0x000000010e835130 rb_f_sleep + 97
7   libruby.1.9.1.dylib             0x000000010e8efce0 call_cfunc + 281
8   libruby.1.9.1.dylib             0x000000010e8efb48 vm_call_cfunc + 287
9   libruby.1.9.1.dylib             0x000000010e8eecfc vm_call_method + 370
10  libruby.1.9.1.dylib             0x000000010e8e9945 vm_exec_core + 11533
11  libruby.1.9.1.dylib             0x000000010e8f9876 vm_exec + 147
12  libruby.1.9.1.dylib             0x000000010e8f8348 invoke_block_from_c + 584
13  libruby.1.9.1.dylib             0x000000010e8f84ce rb_vm_invoke_proc + 253
14  libruby.1.9.1.dylib             0x000000010e8fec65 thread_start_func_2 + 571
15  libruby.1.9.1.dylib             0x000000010e8fda27 thread_start_func_1 + 58
16  libsystem_c.dylib               0x00007fff8ab608bf _pthread_start + 335
17  libsystem_c.dylib               0x00007fff8ab63b75 thread_start + 13

Thread 3:
0   libsystem_kernel.dylib          0x00007fff8cf4dbca __psynch_cvwait + 10
1   libsystem_c.dylib               0x00007fff8ab64274 _pthread_cond_wait + 840
2   libruby.1.9.1.dylib             0x000000010e8fd6b4 native_cond_timedwait + 37
3   libruby.1.9.1.dylib             0x000000010e8fdd33 native_sleep + 298
4   libruby.1.9.1.dylib             0x000000010e8ffa9e sleep_timeval + 129
5   libruby.1.9.1.dylib             0x000000010e8ffc63 rb_thread_wait_for + 47
6   libruby.1.9.1.dylib             0x000000010e835130 rb_f_sleep + 97
7   libruby.1.9.1.dylib             0x000000010e8efce0 call_cfunc + 281
8   libruby.1.9.1.dylib             0x000000010e8efb48 vm_call_cfunc + 287
9   libruby.1.9.1.dylib             0x000000010e8eecfc vm_call_method + 370
10  libruby.1.9.1.dylib             0x000000010e8e9945 vm_exec_core + 11533
11  libruby.1.9.1.dylib             0x000000010e8f9876 vm_exec + 147
12  libruby.1.9.1.dylib             0x000000010e8f8348 invoke_block_from_c + 584
13  libruby.1.9.1.dylib             0x000000010e8f84ce rb_vm_invoke_proc + 253
14  libruby.1.9.1.dylib             0x000000010e8fec65 thread_start_func_2 + 571
15  libruby.1.9.1.dylib             0x000000010e8fda27 thread_start_func_1 + 58
16  libsystem_c.dylib               0x00007fff8ab608bf _pthread_start + 335
17  libsystem_c.dylib               0x00007fff8ab63b75 thread_start + 13

Thread 4 Crashed:
0   com.apple.CoreFoundation        0x00007fff95a7fedf __CFInitialize + 63
1   dyld                            0x00007fff6e385e6f ImageLoaderMachO::doImageInit(ImageLoader::LinkContext const&) + 147
2   dyld                            0x00007fff6e385ae7 ImageLoaderMachO::doInitialization(ImageLoader::LinkContext const&) + 35
3   dyld                            0x00007fff6e3832e4 ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int, ImageLoader::InitializerTimingList&) + 260
4   dyld                            0x00007fff6e38327d ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int, ImageLoader::InitializerTimingList&) + 157
5   dyld                            0x00007fff6e38327d ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int, ImageLoader::InitializerTimingList&) + 157
6   dyld                            0x00007fff6e3840b7 ImageLoader::runInitializers(ImageLoader::LinkContext const&, ImageLoader::InitializerTimingList&) + 59
7   dyld                            0x00007fff6e3791b9 dyld::runInitializers(ImageLoader*) + 97
8   dyld                            0x00007fff6e37f657 dlopen + 540
9   libdyld.dylib                   0x00007fff8df5a95b dlopen + 57
10  libpython2.7.dylib              0x00000001101558c5 _PyImport_GetDynLoadFunc + 359
11  libpython2.7.dylib              0x0000000110141a96 _PyImport_LoadDynamicModule + 101
12  libpython2.7.dylib              0x0000000110140246 0x1100a6000 + 631366
13  libpython2.7.dylib              0x0000000110140454 0x1100a6000 + 631892
14  libpython2.7.dylib              0x0000000110141201 PyImport_ImportModuleLevel + 1137
15  libpython2.7.dylib              0x0000000110125506 0x1100a6000 + 521478
16  libpython2.7.dylib              0x00000001100add32 PyObject_Call + 97
17  libpython2.7.dylib              0x0000000110129c40 PyEval_CallObjectWithKeywords + 180
18  libpython2.7.dylib              0x000000011012f8d9 PyEval_EvalFrameEx + 20871
19  libpython2.7.dylib              0x0000000110130cd8 PyEval_EvalCodeEx + 1996
20  libpython2.7.dylib              0x0000000110130d4d PyEval_EvalCode + 54
21  libpython2.7.dylib              0x000000011013ef3a PyImport_ExecCodeModuleEx + 211
22  libpython2.7.dylib              0x000000011013f482 0x1100a6000 + 627842
23  libpython2.7.dylib              0x0000000110140246 0x1100a6000 + 631366
24  libpython2.7.dylib              0x0000000110140492 0x1100a6000 + 631954
25  libpython2.7.dylib              0x0000000110141201 PyImport_ImportModuleLevel + 1137
26  libpython2.7.dylib              0x0000000110125506 0x1100a6000 + 521478
27  libpython2.7.dylib              0x00000001100add32 PyObject_Call + 97
28  libpython2.7.dylib              0x0000000110129c40 PyEval_CallObjectWithKeywords + 180
29  libpython2.7.dylib              0x000000011012f8d9 PyEval_EvalFrameEx + 20871
30  libpython2.7.dylib              0x0000000110130cd8 PyEval_EvalCodeEx + 1996
31  libpython2.7.dylib              0x0000000110130d4d PyEval_EvalCode + 54
32  libpython2.7.dylib              0x000000011013ef3a PyImport_ExecCodeModuleEx + 211
33  libpython2.7.dylib              0x000000011013f482 0x1100a6000 + 627842
34  libpython2.7.dylib              0x0000000110140246 0x1100a6000 + 631366
35  libpython2.7.dylib              0x0000000110140454 0x1100a6000 + 631892
36  libpython2.7.dylib              0x0000000110141246 PyImport_ImportModuleLevel + 1206
37  libpython2.7.dylib              0x0000000110125506 0x1100a6000 + 521478
38  libpython2.7.dylib              0x00000001100add32 PyObject_Call + 97
39  libpython2.7.dylib              0x0000000110129c40 PyEval_CallObjectWithKeywords + 180
40  libpython2.7.dylib              0x000000011012f8d9 PyEval_EvalFrameEx + 20871
41  libpython2.7.dylib              0x0000000110130cd8 PyEval_EvalCodeEx + 1996
42  libpython2.7.dylib              0x0000000110130d4d PyEval_EvalCode + 54
43  libpython2.7.dylib              0x000000011013ef3a PyImport_ExecCodeModuleEx + 211
44  libpython2.7.dylib              0x000000011013f482 0x1100a6000 + 627842
45  libpython2.7.dylib              0x0000000110140246 0x1100a6000 + 631366
46  libpython2.7.dylib              0x0000000110140454 0x1100a6000 + 631892
47  libpython2.7.dylib              0x0000000110141246 PyImport_ImportModuleLevel + 1206
48  libpython2.7.dylib              0x0000000110125506 0x1100a6000 + 521478
49  libpython2.7.dylib              0x00000001100add32 PyObject_Call + 97
50  libpython2.7.dylib              0x0000000110129c40 PyEval_CallObjectWithKeywords + 180
51  libpython2.7.dylib              0x000000011012f8d9 PyEval_EvalFrameEx + 20871
52  libpython2.7.dylib              0x0000000110130cd8 PyEval_EvalCodeEx + 1996
53  libpython2.7.dylib              0x0000000110130d4d PyEval_EvalCode + 54
54  libpython2.7.dylib              0x000000011013ef3a PyImport_ExecCodeModuleEx + 211
55  libpython2.7.dylib              0x000000011013f482 0x1100a6000 + 627842
56  libpython2.7.dylib              0x0000000110140246 0x1100a6000 + 631366
57  libpython2.7.dylib              0x0000000110140454 0x1100a6000 + 631892
58  libpython2.7.dylib              0x0000000110141246 PyImport_ImportModuleLevel + 1206
59  libpython2.7.dylib              0x0000000110125506 0x1100a6000 + 521478
60  libpython2.7.dylib              0x000000011012dd77 PyEval_EvalFrameEx + 13861
61  libpython2.7.dylib              0x0000000110130df7 0x1100a6000 + 568823
62  libpython2.7.dylib              0x000000011012de0a PyEval_EvalFrameEx + 14008
63  libpython2.7.dylib              0x00000001100c57ac 0x1100a6000 + 128940
64  libpython2.7.dylib              0x000000011012aaea PyEval_EvalFrameEx + 920
65  libpython2.7.dylib              0x0000000110130cd8 PyEval_EvalCodeEx + 1996
66  libpython2.7.dylib              0x00000001100ceabf 0x1100a6000 + 166591
67  libpython2.7.dylib              0x00000001100add32 PyObject_Call + 97
68  ffi_c.bundle                    0x000000010f72c8b4 ffi_call_unix64 + 76
69  ffi_c.bundle                    0x000000010f72c265 ffi_call + 1152
70  ffi_c.bundle                    0x000000010f71e7d3 rbffi_CallFunction + 816
71  ffi_c.bundle                    0x000000010f72311f ffi_trampoline_end + 77
72  libruby.1.9.1.dylib             0x000000010e8efce0 call_cfunc + 281
73  libruby.1.9.1.dylib             0x000000010e8efb48 vm_call_cfunc + 287
74  libruby.1.9.1.dylib             0x000000010e8eecfc vm_call_method + 370
75  libruby.1.9.1.dylib             0x000000010e8e9945 vm_exec_core + 11533
76  libruby.1.9.1.dylib             0x000000010e8f9876 vm_exec + 147
77  libruby.1.9.1.dylib             0x000000010e8f3077 vm_call0 + 484
78  libruby.1.9.1.dylib             0x000000010e8f4641 rb_call0 + 171
79  libruby.1.9.1.dylib             0x000000010e8f4594 rb_call + 59
80  libruby.1.9.1.dylib             0x000000010e8f48ac rb_funcall2 + 49
81  libruby.1.9.1.dylib             0x000000010e8f0801 vm_method_missing + 180
82  libruby.1.9.1.dylib             0x000000010e8ef6f4 vm_call_method + 2922
83  libruby.1.9.1.dylib             0x000000010e8e9945 vm_exec_core + 11533
84  libruby.1.9.1.dylib             0x000000010e8f9876 vm_exec + 147
85  libruby.1.9.1.dylib             0x000000010e8f3077 vm_call0 + 484
86  libruby.1.9.1.dylib             0x000000010e8f4641 rb_call0 + 171
87  libruby.1.9.1.dylib             0x000000010e8f4594 rb_call + 59
88  libruby.1.9.1.dylib             0x000000010e8f4861 rb_funcall + 534
89  redcarpet.bundle                0x000000010f087cd4 rndr_blockcode + 216
90  redcarpet.bundle                0x000000010f084f9c parse_blockcode + 447
91  redcarpet.bundle                0x000000010f08666d parse_block + 582
92  redcarpet.bundle                0x000000010f087380 sd_markdown_render + 677
93  redcarpet.bundle                0x000000010f087ab8 rb_redcarpet_md_render + 401
94  libruby.1.9.1.dylib             0x000000010e8efd17 call_cfunc + 336
95  libruby.1.9.1.dylib             0x000000010e8efb48 vm_call_cfunc + 287
96  libruby.1.9.1.dylib             0x000000010e8eecfc vm_call_method + 370
97  libruby.1.9.1.dylib             0x000000010e8e9945 vm_exec_core + 11533
98  libruby.1.9.1.dylib             0x000000010e8f9876 vm_exec + 147
99  libruby.1.9.1.dylib             0x000000010e8f8348 invoke_block_from_c + 584
100 libruby.1.9.1.dylib             0x000000010e8f83cf vm_yield + 76
101 libruby.1.9.1.dylib             0x000000010e8f4afc rb_yield_0 + 37
102 libruby.1.9.1.dylib             0x000000010e8f6617 catch_i + 30
103 libruby.1.9.1.dylib             0x000000010e8f67b6 rb_catch_obj + 221
104 libruby.1.9.1.dylib             0x000000010e8f6674 rb_f_catch + 91
105 libruby.1.9.1.dylib             0x000000010e8efce0 call_cfunc + 281
106 libruby.1.9.1.dylib             0x000000010e8efb48 vm_call_cfunc + 287
107 libruby.1.9.1.dylib             0x000000010e8eecfc vm_call_method + 370
108 libruby.1.9.1.dylib             0x000000010e8e9945 vm_exec_core + 11533
109 libruby.1.9.1.dylib             0x000000010e8f9876 vm_exec + 147
110 libruby.1.9.1.dylib             0x000000010e8f8348 invoke_block_from_c + 584
111 libruby.1.9.1.dylib             0x000000010e8f83cf vm_yield + 76
112 libruby.1.9.1.dylib             0x000000010e8f4afc rb_yield_0 + 37
113 libruby.1.9.1.dylib             0x000000010e8f4acd rb_yield + 57
114 libruby.1.9.1.dylib             0x000000010e785aa3 rb_ary_each + 146
115 libruby.1.9.1.dylib             0x000000010e8efcf8 call_cfunc + 305
116 libruby.1.9.1.dylib             0x000000010e8efb48 vm_call_cfunc + 287
117 libruby.1.9.1.dylib             0x000000010e8eecfc vm_call_method + 370
118 libruby.1.9.1.dylib             0x000000010e8e9945 vm_exec_core + 11533
119 libruby.1.9.1.dylib             0x000000010e8f9876 vm_exec + 147
120 libruby.1.9.1.dylib             0x000000010e8f8348 invoke_block_from_c + 584
121 libruby.1.9.1.dylib             0x000000010e8f84ce rb_vm_invoke_proc + 253
122 libruby.1.9.1.dylib             0x000000010e8fec65 thread_start_func_2 + 571
123 libruby.1.9.1.dylib             0x000000010e8fda27 thread_start_func_1 + 58
124 libsystem_c.dylib               0x00007fff8ab608bf _pthread_start + 335
125 libsystem_c.dylib               0x00007fff8ab63b75 thread_start + 13

Thread 5:
0   libsystem_kernel.dylib          0x00007fff8cf4ddf2 __select + 10
1   libruby.1.9.1.dylib             0x000000010e901d26 rb_fd_select + 177
2   libruby.1.9.1.dylib             0x000000010e901ecf do_select + 423
3   libruby.1.9.1.dylib             0x000000010e9022f9 rb_thread_fd_select + 184
4   libruby.1.9.1.dylib             0x000000010e7e4bd1 select_internal + 1200
5   libruby.1.9.1.dylib             0x000000010e7e50ee select_call + 73
6   libruby.1.9.1.dylib             0x000000010e7b8ec7 rb_ensure + 151
7   libruby.1.9.1.dylib             0x000000010e7e540a rb_f_select + 257
8   libruby.1.9.1.dylib             0x000000010e8efce0 call_cfunc + 281
9   libruby.1.9.1.dylib             0x000000010e8efb48 vm_call_cfunc + 287
10  libruby.1.9.1.dylib             0x000000010e8eecfc vm_call_method + 370
11  libruby.1.9.1.dylib             0x000000010e8e9945 vm_exec_core + 11533
12  libruby.1.9.1.dylib             0x000000010e8f9876 vm_exec + 147
13  libruby.1.9.1.dylib             0x000000010e8f8348 invoke_block_from_c + 584
14  libruby.1.9.1.dylib             0x000000010e8f84ce rb_vm_invoke_proc + 253
15  libruby.1.9.1.dylib             0x000000010e8fec65 thread_start_func_2 + 571
16  libruby.1.9.1.dylib             0x000000010e8fda27 thread_start_func_1 + 58
17  libsystem_c.dylib               0x00007fff8ab608bf _pthread_start + 335
18  libsystem_c.dylib               0x00007fff8ab63b75 thread_start + 13

Thread 6:
0   libsystem_kernel.dylib          0x00007fff8cf4ddf2 __select + 10
1   libruby.1.9.1.dylib             0x000000010e901d26 rb_fd_select + 177
2   libruby.1.9.1.dylib             0x000000010e901ecf do_select + 423
3   libruby.1.9.1.dylib             0x000000010e9022f9 rb_thread_fd_select + 184
4   libruby.1.9.1.dylib             0x000000010e7e4bd1 select_internal + 1200
5   libruby.1.9.1.dylib             0x000000010e7e50ee select_call + 73
6   libruby.1.9.1.dylib             0x000000010e7b8ec7 rb_ensure + 151
7   libruby.1.9.1.dylib             0x000000010e7e540a rb_f_select + 257
8   libruby.1.9.1.dylib             0x000000010e8efce0 call_cfunc + 281
9   libruby.1.9.1.dylib             0x000000010e8efb48 vm_call_cfunc + 287
10  libruby.1.9.1.dylib             0x000000010e8eecfc vm_call_method + 370
11  libruby.1.9.1.dylib             0x000000010e8e9945 vm_exec_core + 11533
12  libruby.1.9.1.dylib             0x000000010e8f9876 vm_exec + 147
13  libruby.1.9.1.dylib             0x000000010e8f8348 invoke_block_from_c + 584
14  libruby.1.9.1.dylib             0x000000010e8f84ce rb_vm_invoke_proc + 253
15  libruby.1.9.1.dylib             0x000000010e8fec65 thread_start_func_2 + 571
16  libruby.1.9.1.dylib             0x000000010e8fda27 thread_start_func_1 + 58
17  libsystem_c.dylib               0x00007fff8ab608bf _pthread_start + 335
18  libsystem_c.dylib               0x00007fff8ab63b75 thread_start + 13

Thread 7:
0   libsystem_kernel.dylib          0x00007fff8cf4ddf2 __select + 10
1   libruby.1.9.1.dylib             0x000000010e901d26 rb_fd_select + 177
2   libruby.1.9.1.dylib             0x000000010e901ecf do_select + 423
3   libruby.1.9.1.dylib             0x000000010e9022f9 rb_thread_fd_select + 184
4   libruby.1.9.1.dylib             0x000000010e7e4bd1 select_internal + 1200
5   libruby.1.9.1.dylib             0x000000010e7e50ee select_call + 73
6   libruby.1.9.1.dylib             0x000000010e7b8ec7 rb_ensure + 151
7   libruby.1.9.1.dylib             0x000000010e7e540a rb_f_select + 257
8   libruby.1.9.1.dylib             0x000000010e8efce0 call_cfunc + 281
9   libruby.1.9.1.dylib             0x000000010e8efb48 vm_call_cfunc + 287
10  libruby.1.9.1.dylib             0x000000010e8eecfc vm_call_method + 370
11  libruby.1.9.1.dylib             0x000000010e8e9945 vm_exec_core + 11533
12  libruby.1.9.1.dylib             0x000000010e8f9876 vm_exec + 147
13  libruby.1.9.1.dylib             0x000000010e8f8348 invoke_block_from_c + 584
14  libruby.1.9.1.dylib             0x000000010e8f84ce rb_vm_invoke_proc + 253
15  libruby.1.9.1.dylib             0x000000010e8fec65 thread_start_func_2 + 571
16  libruby.1.9.1.dylib             0x000000010e8fda27 thread_start_func_1 + 58
17  libsystem_c.dylib               0x00007fff8ab608bf _pthread_start + 335
18  libsystem_c.dylib               0x00007fff8ab63b75 thread_start + 13

Thread 8:
0   libsystem_kernel.dylib          0x00007fff8cf4ddf2 __select + 10
1   libruby.1.9.1.dylib             0x000000010e8fe221 thread_timer + 238
2   libsystem_c.dylib               0x00007fff8ab608bf _pthread_start + 335
3   libsystem_c.dylib               0x00007fff8ab63b75 thread_start + 13

Thread 4 crashed with X86 Thread State (64-bit):
  rax: 0x0000000000000000  rbx: 0x00007fd9ade99010  rcx: 0x00007fff6e375738  rdx: 0x00007fff6e3755e0
  rdi: 0x0000000000000003  rsi: 0x00007fff6e3755c0  rbp: 0x000000010fa4efb0  rsp: 0x000000010fa4e780
   r8: 0x00007fff6e3ab1c0   r9: 0x000000010fa4ef58  r10: 0x0000000000000481  r11: 0x0000000034c10d01
  r12: 0x00007fff6e3ab110  r13: 0x00007fff95a7fea0  r14: 0x00007fff95a03c90  r15: 0x000000000000000a
  rip: 0x00007fff95a7fedf  rfl: 0x0000000000000246  cr2: 0x00007fff7baa77ca
Logical CPU: 0

Binary Images:
       0x10e776000 -        0x10e776fff +ruby (??? - ???) <E368E846-742A-3FB0-BCDC-845AB2BACA72> /Users/USER/*/ruby
       0x10e77b000 -        0x10e9a5fef +libruby.1.9.1.dylib (1.9.1 - compatibility 1.9.1) <482E530F-6F41-36AD-904C-A6D2878EB24E> /Users/USER/*/libruby.1.9.1.dylib
       0x10eac3000 -        0x10eac4fff +encdb.bundle (??? - ???) <1DE33307-5914-31AA-BDBB-FE3B689B0D42> /Users/USER/*/encdb.bundle
       0x10eac7000 -        0x10eac8fff +transdb.bundle (??? - ???) <39A28688-87C3-3DFB-95C1-1FC3E26CB591> /Users/USER/*/transdb.bundle
       0x10eacc000 -        0x10eacdfff +etc.bundle (??? - ???) <F4C485F6-39E3-359E-8DBB-270C284B4EE5> /Users/USER/*/etc.bundle
       0x10ead0000 -        0x10ead5fff +pathname.bundle (??? - ???) <B96E8B98-84DF-3484-AD75-B38D2D743B54> /Users/USER/*/pathname.bundle
       0x10eada000 -        0x10eadefff +psych.bundle (??? - ???) <BB17C74B-479D-3437-9243-F4F10485A130> /Users/USER/*/psych.bundle
       0x10eae3000 -        0x10eae8fff +stringio.bundle (??? - ???) <971DD092-1073-348F-9516-2FAF955B76CC> /Users/USER/*/stringio.bundle
       0x10eaec000 -        0x10eaf1fff +strscan.bundle (??? - ???) <73D28ACA-F87A-3FDF-B9C0-E4D685CEDD2A> /Users/USER/*/strscan.bundle
       0x10eaf7000 -        0x10eaf7fff +sha1.bundle (??? - ???) <0B4F9046-84D5-31D6-B310-FA890BE32978> /Users/USER/*/sha1.bundle
       0x10eafa000 -        0x10eafcfff +digest.bundle (??? - ???) <B66C93EA-8AB6-3962-AC96-D2C6B53FA0DB> /Users/USER/*/digest.bundle
       0x10ed00000 -        0x10ed1bfff +libyaml-0.2.dylib (3.2.0 - compatibility 3.0.0) <B9642F83-FB84-35B1-B0BD-90A4C8C8A68A> /Users/USER/*/libyaml-0.2.dylib
       0x10ed23000 -        0x10ed52fe7 +date_core.bundle (??? - ???) <C95A7FF9-5C6A-35B9-B429-DB3C44D2BFCE> /Users/USER/*/date_core.bundle
       0x10ed90000 -        0x10eeebfef +libcrypto.1.0.0.dylib (??? - ???) <7F5E228D-5EED-34AC-9F77-B4DAB3492ACB> /Users/USER/*/libcrypto.1.0.0.dylib
       0x10ef5c000 -        0x10efaffe7 +libssl.1.0.0.dylib (??? - ???) <FC787803-FE38-38AC-93F3-26E461B0F0A6> /Users/USER/*/libssl.1.0.0.dylib
       0x10efca000 -        0x10efcafef +iso_8859_1.bundle (??? - ???) <5A23599C-6A90-3164-8B25-A48C48E0F5E0> /Users/USER/*/iso_8859_1.bundle
       0x10efcd000 -        0x10efd9fff +zlib.bundle (??? - ???) <787BC16D-A8FC-3CFC-8A79-8D4F32522CD4> /Users/USER/*/zlib.bundle
       0x10efdf000 -        0x10f021fff +openssl.bundle (??? - ???) <97D4C53F-F8BF-39D9-91D6-19197CAD4D10> /Users/USER/*/openssl.bundle
       0x10f03e000 -        0x10f03efff +fcntl.bundle (??? - ???) <1004459D-2806-31DC-BBB5-C6CE8FB0CEF8> /Users/USER/*/fcntl.bundle
       0x10f041000 -        0x10f046ff7 +parser.bundle (??? - ???) <EDA9D86E-D618-3446-9FB9-3915BE1371B9> /Users/USER/*/parser.bundle
       0x10f04a000 -        0x10f04bfff +utf_16be.bundle (??? - ???) <2B0AA360-547F-31D3-B0CD-5D75E0CBF0C2> /Users/USER/*/utf_16be.bundle
       0x10f04e000 -        0x10f04ffff +utf_16le.bundle (??? - ???) <36EC9590-D221-3DF5-89CE-1D9AA9C9C237> /Users/USER/*/utf_16le.bundle
       0x10f052000 -        0x10f052fff +utf_32be.bundle (??? - ???) <A1751A4E-8E49-3030-AF28-F5D1122C6E31> /Users/USER/*/utf_32be.bundle
       0x10f055000 -        0x10f055fff +utf_32le.bundle (??? - ???) <1606E71B-3812-30D3-81A7-9810F0679FB1> /Users/USER/*/utf_32le.bundle
       0x10f058000 -        0x10f05efff +generator.bundle (??? - ???) <2AEDC4F2-39F9-3B7C-BF37-C316B6712C9F> /Users/USER/*/generator.bundle
       0x10f063000 -        0x10f074ff7 +bigdecimal.bundle (??? - ???) <283BE2E4-510F-32B8-86D5-CB3EEC8A4406> /Users/USER/*/bigdecimal.bundle
       0x10f079000 -        0x10f079fff +md5.bundle (??? - ???) <0FFEB4C3-62D6-3F7A-849A-602A7D24C7FF> /Users/USER/*/md5.bundle
       0x10f07c000 -        0x10f08dfef +redcarpet.bundle (??? - ???) <F23BE712-2D88-33A2-BE26-F19E4044F708> /Users/USER/*/redcarpet.bundle
       0x10f093000 -        0x10f0b7fff +socket.bundle (??? - ???) <72D30FC9-5498-3EDF-936F-0827B89C95E4> /Users/USER/*/socket.bundle
       0x10f714000 -        0x10f734ff7 +ffi_c.bundle (??? - ???) <3979D304-67B9-3A5F-84F5-3EC97FF178F6> /Users/USER/*/ffi_c.bundle
       0x10f740000 -        0x10f741fff  cStringIO.so (??? - ???) <CFF72182-B413-3F0E-9E85-6357705A064E> /usr/lib/python2.7/lib-dynload/cStringIO.so
       0x10f746000 -        0x10f749fff  strop.so (??? - ???) <C7B344AC-2B19-33D7-A4EC-08AAEED5175F> /usr/lib/python2.7/lib-dynload/strop.so
       0x10f74e000 -        0x10f74ffff  _functools.so (??? - ???) <6EF3FA09-56D3-3706-8AFB-76E6F5AD1353> /usr/lib/python2.7/lib-dynload/_functools.so
       0x10f753000 -        0x10f753fff  _bisect.so (??? - ???) <75BF5441-4BDE-3AD4-B257-66DE10F73886> /usr/lib/python2.7/lib-dynload/_bisect.so
       0x1100a6000 -        0x1101c1ff7  libpython2.7.dylib (2.7.1 - compatibility 2.7.0) <004F03CD-EB9B-3D50-AAE4-5D707D98727D> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib
       0x110510000 -        0x110516ff7  _socket.so (??? - ???) <6213F0D8-01D2-32B7-A595-5C629FF14402> /usr/lib/python2.7/lib-dynload/_socket.so
       0x11051e000 -        0x110522fff  _ssl.so (??? - ???) <B204A218-0D17-3658-A799-435C7BA3A762> /usr/lib/python2.7/lib-dynload/_ssl.so
       0x110528000 -        0x110529fff  time.so (??? - ???) <DA274462-B33A-33EB-90F7-BB9FB8120A5D> /usr/lib/python2.7/lib-dynload/time.so
       0x11052f000 -        0x110532fff  _collections.so (??? - ???) <8E22D1F8-A82A-3557-B2CB-4B764170AEEB> /usr/lib/python2.7/lib-dynload/_collections.so
       0x110538000 -        0x11053bfff  operator.so (??? - ???) <0E8CABA4-0095-3FE1-A553-7CD80C3065E1> /usr/lib/python2.7/lib-dynload/operator.so
       0x110541000 -        0x110547fff  itertools.so (??? - ???) <A6122009-AA70-3632-BDA1-D915A28E38A9> /usr/lib/python2.7/lib-dynload/itertools.so
       0x110590000 -        0x110591fff  _heapq.so (??? - ???) <CDF90B4F-3045-3AC3-BA39-9273FAB32386> /usr/lib/python2.7/lib-dynload/_heapq.so
       0x110596000 -        0x11059afff  _struct.so (??? - ???) <B2242559-29B9-3109-931D-7A8814CF9D71> /usr/lib/python2.7/lib-dynload/_struct.so
       0x1105a0000 -        0x1105a2ff7  binascii.so (??? - ???) <E06EB9B4-A6F7-3575-B0B5-5C5430350B1F> /usr/lib/python2.7/lib-dynload/binascii.so
       0x1105a6000 -        0x1105a6fff  _scproxy.so (??? - ???) <74EF3D5C-7751-35A9-A479-E41AB4DB7EEE> /usr/lib/python2.7/lib-dynload/_scproxy.so
    0x7fff6e376000 -     0x7fff6e3aabaf  dyld (195.6 - ???) <0CD1B35B-A28F-32DA-B72E-452EAD609613> /usr/lib/dyld
    0x7fff8a2d2000 -     0x7fff8a2d8ff7  libunwind.dylib (30.0.0 - compatibility 1.0.0) <1E9C6C8C-CBE8-3F4B-A5B5-E03E3AB53231> /usr/lib/system/libunwind.dylib
    0x7fff8a747000 -     0x7fff8a752ff7  libc++abi.dylib (14.0.0 - compatibility 1.0.0) <8FF3D766-D678-36F6-84AC-423C878E6D14> /usr/lib/libc++abi.dylib
    0x7fff8ab12000 -     0x7fff8abeffef  libsystem_c.dylib (763.13.0 - compatibility 1.0.0) <41B43515-2806-3FBC-ACF1-A16F35B7E290> /usr/lib/system/libsystem_c.dylib
    0x7fff8c073000 -     0x7fff8c0aefff  libsystem_info.dylib (??? - ???) <35F90252-2AE1-32C5-8D34-782C614D9639> /usr/lib/system/libsystem_info.dylib
    0x7fff8c1fe000 -     0x7fff8c20cfff  libdispatch.dylib (187.10.0 - compatibility 1.0.0) <8E03C652-922A-3399-93DE-9EA0CBFA0039> /usr/lib/system/libdispatch.dylib
    0x7fff8ceca000 -     0x7fff8ced0fff  libmacho.dylib (800.0.0 - compatibility 1.0.0) <165514D7-1BFA-38EF-A151-676DCD21FB64> /usr/lib/system/libmacho.dylib
    0x7fff8cf37000 -     0x7fff8cf57fff  libsystem_kernel.dylib (1699.32.7 - compatibility 1.0.0) <66C9F9BD-C7B3-30D4-B1A0-03C8A6392351> /usr/lib/system/libsystem_kernel.dylib
    0x7fff8d350000 -     0x7fff8d351ff7  libsystem_sandbox.dylib (??? - ???) <2A09E4DA-F47C-35CB-B70C-E0492BA9F20E> /usr/lib/system/libsystem_sandbox.dylib
    0x7fff8df59000 -     0x7fff8df5dfff  libdyld.dylib (195.5.0 - compatibility 1.0.0) <380C3F44-0CA7-3514-8080-46D1C9DF4FCD> /usr/lib/system/libdyld.dylib
    0x7fff8e55a000 -     0x7fff8e564ff7  liblaunch.dylib (392.39.0 - compatibility 1.0.0) <8C235D13-2928-30E5-9E12-2CC3D6324AE2> /usr/lib/system/liblaunch.dylib
    0x7fff8e9ba000 -     0x7fff8e9c2fff  libsystem_dnssd.dylib (??? - ???) <584B321E-5159-37CD-B2E7-82E069C70AFB> /usr/lib/system/libsystem_dnssd.dylib
    0x7fff8f206000 -     0x7fff8f208fff  com.apple.TrustEvaluationAgent (2.0 - 1) <1F31CAFF-C1C6-33D3-94E9-11B721761DDF> /System/Library/PrivateFrameworks/TrustEvaluationAgent.framework/Versions/A/TrustEvaluationAgent
    0x7fff8feb6000 -     0x7fff8feeffe7  libssl.0.9.8.dylib (44.0.0 - compatibility 0.9.8) <79AAEC98-1258-3DA4-B1C0-4120049D390B> /usr/lib/libssl.0.9.8.dylib
    0x7fff8ff97000 -     0x7fff8ff9efff  libcopyfile.dylib (85.1.0 - compatibility 1.0.0) <0AB51EE2-E914-358C-AC19-47BC024BDAE7> /usr/lib/system/libcopyfile.dylib
    0x7fff908a0000 -     0x7fff908a9ff7  libsystem_notify.dylib (80.1.0 - compatibility 1.0.0) <A4D651E3-D1C6-3934-AD49-7A104FD14596> /usr/lib/system/libsystem_notify.dylib
    0x7fff9132c000 -     0x7fff9132dfff  libDiagnosticMessagesClient.dylib (??? - ???) <3DCF577B-F126-302B-BCE2-4DB9A95B8598> /usr/lib/libDiagnosticMessagesClient.dylib
    0x7fff9197c000 -     0x7fff91a60e5f  libobjc.A.dylib (228.0.0 - compatibility 1.0.0) <871E688B-CF57-3BC7-80D6-F6476DFF109B> /usr/lib/libobjc.A.dylib
    0x7fff92245000 -     0x7fff92262fff  libxpc.dylib (77.19.0 - compatibility 1.0.0) <9F57891B-D7EF-3050-BEDD-21E7C6668248> /usr/lib/system/libxpc.dylib
    0x7fff92946000 -     0x7fff92992ff7  com.apple.SystemConfiguration (1.11.3 - 1.11) <0A7F1982-B4EA-3424-A0C7-FE46C6224F03> /System/Library/Frameworks/SystemConfiguration.framework/Versions/A/SystemConfiguration
    0x7fff92cce000 -     0x7fff92ed0fff  libicucore.A.dylib (46.1.0 - compatibility 1.0.0) <0176782F-9526-3905-813A-7A5676EC2C86> /usr/lib/libicucore.A.dylib
    0x7fff9352b000 -     0x7fff9353dff7  libz.1.dylib (1.2.5 - compatibility 1.0.0) <30CBEF15-4978-3DED-8629-7109880A19D4> /usr/lib/libz.1.dylib
    0x7fff937af000 -     0x7fff937b0ff7  libsystem_blocks.dylib (53.0.0 - compatibility 1.0.0) <8BCA214A-8992-34B2-A8B9-B74DEACA1869> /usr/lib/system/libsystem_blocks.dylib
    0x7fff937f0000 -     0x7fff937f2fff  libquarantine.dylib (36.7.0 - compatibility 1.0.0) <8D9832F9-E4A9-38C3-B880-E5210B2353C7> /usr/lib/system/libquarantine.dylib
    0x7fff937f3000 -     0x7fff937f4fff  libdnsinfo.dylib (395.11.0 - compatibility 1.0.0) <853BAAA5-270F-3FDC-B025-D448DB72E1C3> /usr/lib/system/libdnsinfo.dylib
    0x7fff93983000 -     0x7fff939b0fe7  libSystem.B.dylib (159.1.0 - compatibility 1.0.0) <7BEBB139-50BB-3112-947A-F4AA168F991C> /usr/lib/libSystem.B.dylib
    0x7fff93d2a000 -     0x7fff93d78fff  libauto.dylib (??? - ???) <D8AC8458-DDD0-3939-8B96-B6CED81613EF> /usr/lib/libauto.dylib
    0x7fff93d79000 -     0x7fff93d7efff  libcache.dylib (47.0.0 - compatibility 1.0.0) <1571C3AB-BCB2-38CD-B3B2-C5FC3F927C6A> /usr/lib/system/libcache.dylib
    0x7fff9416f000 -     0x7fff941e5ff7  libc++.1.dylib (28.4.0 - compatibility 1.0.0) <A24FC3DA-4FFA-3DD2-9DCC-2B8D1B3BF97C> /usr/lib/libc++.1.dylib
    0x7fff94247000 -     0x7fff94353fff  libcrypto.0.9.8.dylib (44.0.0 - compatibility 0.9.8) <3A8E1F89-5E26-3C8B-B538-81F5D61DBF8A> /usr/lib/libcrypto.0.9.8.dylib
    0x7fff94354000 -     0x7fff94354fff  libkeymgr.dylib (23.0.0 - compatibility 1.0.0) <61EFED6A-A407-301E-B454-CD18314F0075> /usr/lib/system/libkeymgr.dylib
    0x7fff945c4000 -     0x7fff945c9fff  libcompiler_rt.dylib (6.0.0 - compatibility 1.0.0) <98ECD5F6-E85C-32A5-98CD-8911230CB66A> /usr/lib/system/libcompiler_rt.dylib
    0x7fff949a0000 -     0x7fff949a4fff  libmathCommon.A.dylib (2026.0.0 - compatibility 1.0.0) <FF83AFF7-42B2-306E-90AF-D539C51A4542> /usr/lib/system/libmathCommon.A.dylib
    0x7fff959aa000 -     0x7fff959abfff  libunc.dylib (24.0.0 - compatibility 1.0.0) <337960EE-0A85-3DD0-A760-7134CF4C0AFF> /usr/lib/system/libunc.dylib
    0x7fff95a03000 -     0x7fff95bd7ff7  com.apple.CoreFoundation (6.7.2 - 635.21) <62A3402E-A4E7-391F-AD20-1EF20236CE1B> /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
    0x7fff95cd1000 -     0x7fff95cd2ff7  libremovefile.dylib (21.1.0 - compatibility 1.0.0) <739E6C83-AA52-3C6C-A680-B37FE2888A04> /usr/lib/system/libremovefile.dylib
    0x7fff96e33000 -     0x7fff96e38ff7  libsystem_network.dylib (??? - ???) <5DE7024E-1D2D-34A2-80F4-08326331A75B> /usr/lib/system/libsystem_network.dylib
    0x7fff96f0a000 -     0x7fff96f7dfff  libstdc++.6.dylib (52.0.0 - compatibility 7.0.0) <6BDD43E4-A4B1-379E-9ED5-8C713653DFF2> /usr/lib/libstdc++.6.dylib
    0x7fff96f8c000 -     0x7fff96fceff7  libcommonCrypto.dylib (55010.0.0 - compatibility 1.0.0) <BB770C22-8C57-365A-8716-4A3C36AE7BFB> /usr/lib/system/libcommonCrypto.dylib

External Modification Summary:
  Calls made by other processes targeting this process:
    task_for_pid: 0
    thread_create: 0
    thread_set_state: 0
  Calls made by this process:
    task_for_pid: 0
    thread_create: 0
    thread_set_state: 0
  Calls made by all processes on this machine:
    task_for_pid: 201900
    thread_create: 2
    thread_set_state: 0

VM Region Summary:
ReadOnly portion of Libraries: Total=66.8M resident=55.3M(83%) swapped_out_or_unallocated=11.5M(17%)
Writable regions: Total=118.4M written=49.5M(42%) resident=72.8M(61%) swapped_out=0K(0%) unallocated=45.6M(39%)

REGION TYPE                      VIRTUAL
===========                      =======
MALLOC                            103.8M
MALLOC guard page                    32K
MALLOC_LARGE (reserved)            2304K        reserved VM address space (unallocated)
STACK GUARD                        56.0M
Stack                              11.6M
VM_ALLOCATE                           8K
__DATA                             2052K
__LINKEDIT                         50.3M
__TEXT                             16.5M
__UNICODE                           544K
shared memory                        12K
===========                      =======
TOTAL                             243.0M
TOTAL, minus reserved VM space    240.8M

Incorrect line indentation

I have some problems with the line indentation. I use middleman-blog.

Gemfile

gem 'redcarpet', '~> 2.3.0'

config.rb

set :markdown_engine, :redcarpet
set :markdown, fenced_code_blocks: true, smartypants: true
activate :syntax,
         :linenos => 'inline',
         :anchorlinenos => true,
         :linenostart => 2

_syntax.css.erb

<%= Rouge::Themes::Github.render(scope: '.highlight') %>

example.html.markdown

```php
<?php
public function send($to, $from, $subject, $text) {
  $mail = new Zend_Mail();
  $mail->addTo($to)
       ->setFrom($from)
       ->setSubject($subject)
       ->setBodyText($text)
       ->send();
}
?>
\```

(Please ignore the backslash. It's only for GitHub.)

Result:
github

Expected result:

<?php
public function send($to, $from, $subject, $text) {
  $mail = new Zend_Mail();
  $mail->addTo($to)
       ->setFrom($from)
       ->setSubject($subject)
       ->setBodyText($text)
       ->send();
}
?>

Have I done something wrong? Have an idea?

erb indentation problems

I'm not sure why this is happening, and I can't find a workaround. I'm trying to put code examples into erb files but it's preserving my space indentation (2 spaces) within the code block. e.g. this...

 <div class="col span3">
  <% code("html") do %>
    <h1>This is a default heading 1 style</h1>
  <% end %>
 </div>

Is showing as

screen shot 2014-04-03 at 11 12 04

But if I remove all my indentation the examples work properly (although everything is left aligned so it doesn't make for very nice code examples), any ideas? Does it only work when using markdown files and not in erb templates?

Doesn't seem to work with asciidoc

gem "middleman-syntax"
gem "asciidoctor"
set :markdown_engine, :redcarpet                                                                                                                                    set :markdown, fenced_code_blocks: true, smartypants: true                                                                                                          
activate :syntax, line_numbers: true                                                                                                                                
activate :asciidoc                                                                                                                                                  
set :asciidoc_attributes, %w(source-highlighter=rouge imagesdir=images) 

When a template is *.html.md, the code block gets decorated.

When a template is *.html.asciidoc, the code block does not get decorated.

Rack incompatibility with rails 4.0.0.rc1

I'm not able to install middleman-syntax w/ rails 4.0.0.rc1 - I get the follow error when running bundle install:

Bundler could not find compatible versions for gem "rack":
  In Gemfile:
    middleman-syntax (>= 0) ruby depends on
      rack (~> 1.4.1) ruby

    rails (= 4.0.0.rc1) ruby depends on
      rack (1.5.2)

My Gemfile:

source 'https://rubygems.org'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.0.rc1'
gem 'puma'
gem 'pg'

gem 'rspec-rails'

gem 'turbolinks'
gem 'jbuilder', '~> 1.0.1'

gem 'sass-rails', '~> 4.0.0.rc1'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'haml-rails'
gem 'jquery-rails'
gem 'flatui-rails', git: "git://github.com/kcurtin/flatui-rails.git"
gem 'truncate_html'

gem 'redcarpet'
# gem 'pygments.rb'
gem 'middleman-syntax'
gem 'reverse_markdown'

group :doc do
  # bundle exec rake doc:rails generates the API under doc/api.
  gem 'sdoc', require: false
end

group :development, :test do
    gem 'rspec-rails'
    gem 'debugger'
end

Code Line Highlighting

Hello, thanks for much for this gem, it is awesome.

I wanted to know if it's possible to highlight specific lines of code? For example:

def add(a,b)
  c = a + b
  puts c # I want to highlight this line
end

Unable to get line numbers working

I'm not quite sure what I'm doing wrong. I've included 'middleman-syntax' and 'redcarpet' as dependencies in my Gemfile, and added the following to my config.rb:

set :markdown_engine, :redcarpet
set :markdown, 
    :fenced_code_blocks => true, 
    :smartypants => true

activate :syntax, 
         :linenos => 'inline', 
         :lineanchors => true

But line numbers are not emitted into the output code, and no errors are shown. Am I doing something obviously wrong?

How to disable line numbers on specific code block?

Hi,

Is there a way to disable line numbers on specific code block? Generally, I want to have line numbers on my code blocks but there are occasions where I would like to disable line numbers on specific code block.

I'm using markdown with fenced code blocks.

# config.rb
set :markdown, :fenced_code_blocks => true, :smartypants => true

This is a markdown code block with ruby with line numbers, just for an example:

```ruby
# hello.rb
def hello
  puts "hello"
end
```

The end result is a code block with line numbers:

1  # hello.rb
2  def hello
3    puts "hello"
4  end

This is a markdown code block where I would like to disable line numbers:

This is just an imaginary example, there is no nolinenumbers syntax.

```nolinenumbers
middleman init MY_PROJECT
bundle exec middleman serve
```

The end result would be a code block without line numbers:

middleman init MY_PROJECT
bundle exec middleman serve

Is there an option or parameter that would handle this?

Push v3.1.0 to rubygems? ๐Ÿ˜…

Hey there,

Would it be possible to release v3.1.0 of middleman-syntax sometime soon? ๐Ÿ˜… It looks like the update with the new version of Rouge got merged here but the version on rubygems is still 3.0.0. I created #76 to include the latest Rouge version but wasn't sure if I should increment the version number as this was not released.

Thanks in advance!

Unbelievably difficult to get syntax highlighting working

Some general background/development environment

Versions:

Ruby: 2.3.0
Middleman: 4.1.10
Middleman-blog: 4.0.1
Middleman-syntax: 3.0.0

Unresolved spec:

WARN: Unresolved specs during Gem::Specification.reset:
      hashie (~> 3.4)
WARN: Clearing out unresolved specs.
Please report a bug if this causes problems.

Snippet from Gemfile.lock

hashie (3.4.4)
middleman-core (4.1.10)
  hashie (~> 3.4)

The problem

As the documentation suggested, I created a _rogue.css.erb file which had the following line in it:
<%= Rouge::Themes::ThankfulEyes.render(:scope => '.highlight') %>
Then, I proceeded to include it in my site.css.scss file with @import "_rogue.css", which apparently, results in nothing being added to the built site.css file. In fact, the file is not found on the build. I'm kind of stuck here -- the documentation says create a .css.erb file but exclude it from middleman's build -- but then how do we use it?

Code blocks worked pretty well, almost straight out of the box with the suggested config, even with Slim and in Markdown files. I have spent over 6+ hours trying to get syntax highlighting to work, though.
My Gemfile includes:

gem 'middleman-syntax'
gem 'redcarpet', '~> 3.3', '>= 3.3.3'

My config.rb file includes

activate :syntax, :line_numbers => true, :inline_theme => "ThankfulEyes"
set :markdown_engine, :redcarpet
set :markdown, :fenced_code_blocks => true, :smartypants => true

This throws the following error:

undefined method `style_for' for "ThankfulEyes":String

Now, I was able to fix the blog article page by editing my config.rb file to this:

activate :syntax, :line_numbers => true, :inline_theme => Rouge::Themes::ThankfulEyes.new

From what I figured out using hit and trial from Rogue Issue #122. If I understand correctly, passing a string should work fine, but it doesn't?

Now, all the pages work fine (blog, article, tags and calendar).

If this is the intended code, why is the documentation outdated?
If this is not the intended code, and passing a string should work, why does it not?
What am I doing wrong with the _rogue.css.erb file that prevents it from working at all?

uninitialized constant #<Class:...>::Rouge

Gemfile

# If you have OpenSSL installed, we recommend updating
# the following line to use "https"
source 'http://rubygems.org'

gem "middleman", "~>3.3.5"
gem "middleman-syntax"

# Live-reloading plugin
gem "middleman-livereload", "~> 3.1.0"

# For faster file watcher updates on Windows:
gem "wdm", "~> 0.1.0", :platforms => [:mswin, :mingw]

# Windows does not come with time zone data
gem "tzinfo-data", platforms: [:mswin, :mingw]

gem 'rake'
/* source/stylesheets/syntax.css.erb */
<%= Rouge::Themes::ThankfulEyes.render(:scope => '.highlight') %>
<!-- source/layouts/layout.erb -->
<%= stylesheet_link_tag "all", "new", "syntax" %>

I must be doing something silly, but I don't quite understand how middleman works.

Indentation problem with fenced code blocks in Markdown

I'm using middleman-syntax with Redcarpet to get GitHub-style code blocks and everything's working fine, except that the indentation is off, as you can see here:

http://tmb-middleman.herokuapp.com/2013/02/20/a-look-at-a-meteor-template/

The same problem was also reported on Stack Overflow but in that case the code block was inside HAML whereas here it's inside Markdown.

Here is my config.rb file:

activate :syntax

set :markdown_engine, :redcarpet
set :markdown, :fenced_code_blocks => true, :smartypants => true

Cannot get syntax-highlighting to work

I have the following settings:

#
# Markdown settings (config.rb)
#
set :markdown_engine, :redcarpet
set :redcarpet, :autolink => true, :no_intra_emphasis => true, :fenced_code_blocks => true, :strikethrough => true
activate :syntax
#
# Snippet from Gemfile
#
gem "middleman-syntax"
gem "redcarpet"

yet, I cannot get the syntax highlighting to work from a blog post. What am I doing wrong?

Highlight specific lines in code block

It is important when you want to make emphasis on specific lines in code block.

The problem is that everything in code block is interpreted as code, and as far as I know there's no way to add special markup for that highlighting:

  script:
  - apt-get update && apt-get install lftp
<b>  - lftp -c "open -u $FTP_LOGIN,$FTP_PASSWORD $SERVER; $FTP_COMMANDS"<b>

Do you maybe have an idea how to approach this problem?

middleman 4.0.0.rc.1 support

I tried to use this gem in a middleman 4.0.0.rc.1 project and looks this gem still not support the next version.

Bundler could not find compatible versions for gem "middleman-core":
  In Gemfile:
    middleman-sprockets (>= 4.0.0.rc.1) ruby depends on
      middleman-core (>= 4.0.0.rc.1) ruby

    middleman (>= 4.0.0.rc.1) ruby depends on
      middleman-core (= 4.0.0.rc.1) ruby

    middleman-sprockets (>= 4.0.0.rc.1) ruby depends on
      middleman-core (>= 4.0.0.rc.1) ruby

    middleman-syntax (>= 0) ruby depends on
      middleman-core (~> 3.0.0) ruby

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.