diff --git a/assets/js/search-data.json b/assets/js/search-data.json
index 12de52214628d45f174450e1a584b98ac0ba0892..49cbc9dcbc2eeea44a9d48c8f0cbf3a14def27a9 100644
--- a/assets/js/search-data.json
+++ b/assets/js/search-data.json
@@ -3,10 +3,10 @@
 {
   {% for page in site.html_pages %}{% if page.search_exclude != true %}"{{ forloop.index0 }}": {
     "id": "{{ forloop.index0 }}",
-    "title": "{{ page.title | xml_escape }}",
-    "content": "{{ page.content | newline_to_br | replace: '<br />', ' ' | replace: '</h1>', ' ' | strip_newlines | markdownify | strip_html | remove: 'Table of contents' | xml_excape | escape | replace: '\', ' ' | replace: '```', '' | replace: '   ', ' ' | replace: '    ', ' ' | remove: '---' | remove: '#####' | remove: '####' | remove: '###' | remove: '##' | strip_newlines }}",
-    "url": "{{ page.url | absolute_url | xml_escape }}",
-    "relUrl": "{{ page.url | xml_escape }}"
-  }{% if forloop.last %}{% else %},{% endif %}
+    "title": "{{ page.title | replace: '&amp;', '&' }}",
+    "content": "{{ page.content | markdownify | strip_html | escape_once | remove: 'Table of contents' | remove: '```'  | remove: '---' | replace: '\', ' ' | normalize_whitespace }}",
+    "url": "{{ page.url | absolute_url }}",
+    "relUrl": "{{ page.url }}"
+  }{% unless forloop.last %},{% endunless %}
   {% endif %}{% endfor %}
 }
diff --git a/docs/configuration.md b/docs/configuration.md
index fcab4953165db84b68a1f6a0d7ca98c8dadfc083..64b23f1a2639919ad668fea24e47fe862b2006e2 100644
--- a/docs/configuration.md
+++ b/docs/configuration.md
@@ -6,18 +6,18 @@ nav_order: 2
 
 # Configuration
 
-Just the Docs has some specific configuration parameters that can be definied in your Jekyll site's `_config.yml` file.
+Just the Docs has some specific configuration parameters that can be defined in your Jekyll site's `_config.yml` file.
 
 ## Search enabled
 
-```yml
+```yaml
 # Enable or disable the site search
 search_enabled: true
 ```
 
 ## Aux links
 
-```yml
+```yaml
 # Aux links for the upper right navigation
 aux_links:
     "Just the Docs on GitHub":
@@ -26,7 +26,7 @@ aux_links:
 
 ## Color scheme
 
-```yml
+```yaml
 # Color scheme currently only supports "dark" or nil (default)
 color_scheme: "dark"
 ```
diff --git a/docs/customization.md b/docs/customization.md
index 74c153c0bff7f96d491ca893a3bd223ab77333b9..f3fe1c036d6bb549638f369c48e911b152444c16 100644
--- a/docs/customization.md
+++ b/docs/customization.md
@@ -28,7 +28,7 @@ To enable a color scheme, set the `color_scheme` parameter in your site's `_conf
 #### Example
 {: .no_toc }
 
-```yml
+```yaml
 # Color scheme currently only supports "dark" or nil (default)
 color_scheme: "dark"
 ```
@@ -68,6 +68,6 @@ $link-color: $blue-000;
 // ...
 ```
 
-_Note:_ Editing the variables directly in `_sass/support/variables.scss` is not recommended and can cause other dependancies to fail.
+_Note:_ Editing the variables directly in `_sass/support/variables.scss` is not recommended and can cause other dependencies to fail.
 
 ---
diff --git a/docs/navigation-structure.md b/docs/navigation-structure.md
index 8a72e5ba0cf3ac0bcbd1ed707a5a373d9ac1bba8..98107cfcc3807de00ccbbcd73a8566019f8c8879 100644
--- a/docs/navigation-structure.md
+++ b/docs/navigation-structure.md
@@ -200,7 +200,7 @@ To add a auxiliary navigation item to your site (in the upper right on all pages
 #### Example
 {: .no_toc }
 
-```yml
+```yaml
 # Aux links for the upper right navigation
 aux_links:
   "Just the Docs on GitHub":
diff --git a/docs/search.md b/docs/search.md
index 24afcd1bc047996757026fa3fe89db22528deed5..134e3997bccdc02afe30e101dad3ce0804fe124c 100644
--- a/docs/search.md
+++ b/docs/search.md
@@ -33,17 +33,17 @@ $ bundle exec just-the-docs rake search:init
 
 This command creates the `search-data.json` file that Jekyll uses to create your search index. Alternatively, you can create the file manually in the `assets/js/` directory of your Jekyll site with this content:
 
-```{% raw %}
----
+```liquid
+{% raw %}---
 ---
 {
-  {% for page in site.html_pages %}"{{ forloop.index0 }}": {
+  {% for page in site.html_pages %}{% if page.search_exclude != true %}"{{ forloop.index0 }}": {
     "id": "{{ forloop.index0 }}",
-    "title": "{{ page.title | xml_escape }}",
-    "content": "{{ page.content | markdownify | strip_html | xml_escape | remove: 'Table of contents' | remove: page.title | strip_newlines | replace: '\', ' '}}",
-    "url": "{{ page.url | absolute_url | xml_escape }}",
-    "relUrl": "{{ page.url | xml_escape }}"
-  }{% if forloop.last %}{% else %},
+    "title": "{{ page.title | replace: '&amp;', '&' }}",
+    "content": "{{ page.content | markdownify | strip_html | escape_once | remove: 'Table of contents' | remove: '```'  | remove: '---' | replace: '\', ' ' | normalize_whitespace }}",
+    "url": "{{ page.url | absolute_url }}",
+    "relUrl": "{{ page.url }}"
+  }{% unless forloop.last %},{% endunless %}
   {% endif %}{% endfor %}
 }{% endraw %}
 ```
@@ -54,7 +54,7 @@ _Note: If you don't run this rake command or create this file manually, search w
 
 In your site's `_config.yml`, enable search:
 
-```yml
+```yaml
 # Enable or disable the site search
 search_enabled: true
 ```
diff --git a/just-the-docs.gemspec b/just-the-docs.gemspec
index 7a0260377a8f91d6bc5bd4fd56ae8235b4413b94..aba1bb57f3519fe09dd23803adcd016565fce2f0 100644
--- a/just-the-docs.gemspec
+++ b/just-the-docs.gemspec
@@ -6,7 +6,7 @@ Gem::Specification.new do |spec|
   spec.authors       = ["Patrick Marsceill"]
   spec.email         = ["patrick.marsceill@gmail.com"]
 
-  spec.summary       = %q{A nice looking, high customizable, responsive Jekyll theme for documention with built-in search.}
+  spec.summary       = %q{A nice looking, highly customizable, responsive Jekyll theme for documentation with built-in search.}
   spec.homepage      = "https://github.com/pmarsceill/just-the-docs"
   spec.license       = "MIT"
 
diff --git a/lib/tasks/search.rake b/lib/tasks/search.rake
index 02d0b5e421b9421056586783dd3f1e745bd12b80..50ef275c3ec4dea13bcb10031c1eaf43bd786226 100644
--- a/lib/tasks/search.rake
+++ b/lib/tasks/search.rake
@@ -4,7 +4,7 @@ namespace :search do
     puts 'Creating search data json file...'
     mkdir_p 'assets/js'
     touch 'assets/js/search-data.json'
-    content = %Q[{{ page.content | markdownify | strip_html | xml_escape | remove: 'Table of contents' | strip_newlines | replace: '\\', ' ' }}]
+    content = %Q[{{ page.content | markdownify | strip_html | escape_once | remove: 'Table of contents' | remove: '```'  | remove: '---' | replace: '\\', ' ' | normalize_whitespace }}]
     puts 'Done.'
     puts 'Generating content...'
 
@@ -12,13 +12,13 @@ namespace :search do
       f.puts '---
 ---
 {
-  {% for page in site.html_pages %}"{{ forloop.index0 }}": {
+  {% for page in site.html_pages %}{% if page.search_exclude != true %}"{{ forloop.index0 }}": {
     "id": "{{ forloop.index0 }}",
-    "title": "{{ page.title | xml_escape }}",
+    "title": "{{ page.title | replace: '&amp;', '&' }}",
     "content": "'+content+'",
-    "url": "{{ page.url | absolute_url | xml_escape }}",
-    "relUrl": "{{ page.url | xml_escape }}"
-  }{% if forloop.last %}{% else %},
+    "url": "{{ page.url | absolute_url }}",
+    "relUrl": "{{ page.url }}"
+  }{% unless forloop.last %},{% endunless %}
   {% endif %}{% endfor %}
 }'
     end