Add JavaScript Environment in the docs and fix a few things

This commit is contained in:
Christopher Chedeau
2015-04-08 11:06:56 -07:00
parent e0a0bb1857
commit 1c7f39e461
3 changed files with 16 additions and 5 deletions

View File

@@ -30,7 +30,7 @@ function splitHeader(content) {
}
function backtickify(str) {
var escaped = '`' + str.replace(/\\/g, '\\\\').replace(/`/g, '\\`') + '`';
var escaped = '`' + str.replace(/\\/g, '\\\\').replace(/`/g, '\\`').replace(/{/g, '\\{') + '`';
// Replace require( with require\( so node-haste doesn't replace example
// require calls in the docs
return escaped.replace(/require\(/g, 'require\\(');