How to turn off Markdown renderer? How to serve static files?

I just discovered Middleman and it looks great, but I have some config issues that already cost me plenty of time. But I think the combination of being able to write HAML plus defining custom helpers should soo make up for it. I really hope I can get some quick help here:

I want to use it to render presentation slides in conjunction with reveal.js.

Issues so far:

  • both Middleman and reveal.js handle Markdown. I want to turn Middleman’s Markdown renderer off. The dev-server config info page tells me that it is turned on, but I couldn’t find any info at all how to turn it off. I tried:
    set :markdown_renderer, nil
    and
    set :markdown_renderer, false

  • The dev-server doesn’t serve static files that I placed in the build folder manually. I copied the reveal.js assets into my build folder within a folder reveal_js/ and protected them from being cleaned via
    set :skip_build_clean, Proc.new { 'reveal_js/*' }
    Why does the dev-server not simply serve all content from the build folder? If that’s not possible due to some technical reason (e.g. watching the sources for changes and hotreloading), then can I at least configure a static asset folder manually?

The dev-server works on source folder only, well… quite by definition. So you have to copy your static assets to source. They will be copied over to build during build. No need to use :skip_build_clean for this. Is there any reason for not using source? I don’t know how you plan to “marry” the reveal.js with Middleman, so I have no other thoughts on this.

I just put the folder with all the reveal.js assets manually into the build folder. Then I built my presentation. This would normally remove the reveal.js assets again, but I protected them from being deleted as described above. After that, my build folder looks like this:

build/
  images/
  javascripts/
  reveal_js/
  stylesheets/
  index.html    # presentation slides with relative links into the reveal_js folder

But this doesn’t work. The files from the reveal_js folder don’t get served at all. So, yes, my expectation was that the middleman dev-server would just serve the whole folder. But it doesn’t do that. Or maybe the :skip_build_clean turns that off as a side effect, which would be really unexpected.

What I havent tried, yet, is sorting all the reveal.js assets into the correct spot in the source directory. Having to do that would be really cumbersome. I guess it is a one time thing and I’d just create a template repo for myself for future presentations. But what if reveal.js gets an update? Do I copy files around manually again?

I took a while to look into the reveal.js thing. It an interesting project, but it comes with its own webserver and runtime environment, including parsing Sass, etc. It not that simple to merge all this into Middleman and retaining dynamic features of both environments, like parsing Markdown.

Yeah, this seems to be a problem. But isn’t copying dist and plugin enough to have all compiled components installed?

Oh wait, I thought the dev-server would also compile to the build folder and serve from there. But it just builds everything in memory and serves it without using the build folder. That explains a lot.

Then I can just do the following:

configure :build do

  # don't process reveal.js, because it was copied to build/ manually
  ignore 'reveal_js/*'

  # and protect it from being deleted on build
  set :skip_build_clean, Proc.new { 'reveal_js/*' }

end

That’s one problem solved.

I think I might have also discovered how to turn off Markdown processing for whole files:

Tilt.default_mapping.template_map.delete('md')
Tilt.default_mapping.template_map.delete('mkd')
Tilt.default_mapping.template_map.delete('mkdn')
Tilt.default_mapping.template_map.delete('mdown')
Tilt.default_mapping.template_map.delete('markdown')

Haven’t tested it, yet, but it should work. But it doesn’t work for inline Markdown, especially not with a :markdown filter. But I think I can live with Markdown getting processed by Middleman in the meantime. I could always fall back to Haml if it were absolutely necessary.