diff --git a/lib/rspec_api_documentation/views/markup_example.rb b/lib/rspec_api_documentation/views/markup_example.rb
index 6f9c72cb..3f88d6ab 100644
--- a/lib/rspec_api_documentation/views/markup_example.rb
+++ b/lib/rspec_api_documentation/views/markup_example.rb
@@ -18,7 +18,7 @@ def respond_to?(method, include_private = false)
       end
 
       def dirname
-        resource_name.downcase.gsub(/\s+/, '_')
+        resource_name.downcase.gsub(/[^0-9A-Za-z.\-]+/, '_')
       end
       
       def filename