diff --git a/_plugins/example.rb b/_plugins/example.rb
index 8a86a2202825e4b9f4fc39a6cff95063804c6a0d..913289720629bcef580cdd191485b4faf5a6cbe0 100644
--- a/_plugins/example.rb
+++ b/_plugins/example.rb
@@ -34,7 +34,7 @@ Syntax Error in tag 'example' while parsing the following markup:
 
   #{markup}
 
-Valid syntax: example <lang>
+Valid syntax: example <lang> [id=foo]
 eos
         end
       end
@@ -55,7 +55,7 @@ eos
       end
 
       def example(output)
-        "<div class=\"bd-example\" data-example-id=\"#{@options[:id]}\">\n#{output}\n</div>"
+        "<div class=\"bd-example\"" + (@options[:id] ? " data-example-id=\"#{@options[:id]}\"" : "") + ">\n#{output}\n</div>"
       end
 
       def remove_holderjs(code)