diff --git a/sphinx_gallery/gen_gallery.py b/sphinx_gallery/gen_gallery.py
index 4d143ba..8ad3d20 100644
--- a/sphinx_gallery/gen_gallery.py
+++ b/sphinx_gallery/gen_gallery.py
@@ -196,17 +196,17 @@ def _complete_gallery_conf(sphinx_gallery_conf, src_dir, plot_gallery,
     # Ensure the first cell text is a string if we have it
     first_cell = gallery_conf.get("first_notebook_cell")
     if (not isinstance(first_cell, str)) and (first_cell is not None):
-        raise ValueError("The 'first_notebook_cell' parameter must be type str"
+        raise ValueError("The 'first_notebook_cell' parameter must be type str "
                          "or None, found type %s" % type(first_cell))
     # Ensure the last cell text is a string if we have it
     last_cell = gallery_conf.get("last_notebook_cell")
     if (not isinstance(last_cell, str)) and (last_cell is not None):
-        raise ValueError("The 'last_notebook_cell' parameter must be type str"
+        raise ValueError("The 'last_notebook_cell' parameter must be type str "
                          "or None, found type %s" % type(last_cell))
     # Make it easy to know which builder we're in
     gallery_conf['builder_name'] = builder_name
     gallery_conf['titles'] = {}
-    # Ensure 'backreferences_dir' is str or Noe
+    # Ensure 'backreferences_dir' is str or None
     backref = gallery_conf['backreferences_dir']
     if (not isinstance(backref, str)) and (backref is not None):
         raise ValueError("The 'backreferences_dir' parameter must be of type "
@@ -294,6 +294,7 @@ def generate_gallery_rst(app):
     examples_dirs = [ex_dir for ex_dir, _ in workdirs]
     files = collect_gallery_files(examples_dirs, gallery_conf)
     check_duplicate_filenames(files)
+    check_spaces_in_filenames(files)
 
     for examples_dir, gallery_dir in workdirs:
 
@@ -611,8 +612,20 @@ def check_duplicate_filenames(files):
 
     if len(dup_names) > 0:
         logger.warning(
-            'Duplicate file name(s) found. Having duplicate file names will '
-            'break some links. List of files: {}'.format(sorted(dup_names),))
+            'Duplicate example file name(s) found. Having duplicate file '
+            'names will break some links. '
+            'List of files: {}'.format(sorted(dup_names),))
+
+
+def check_spaces_in_filenames(files):
+    """Check for spaces in filenames across example directories."""
+    regex = re.compile(r'[\s]')
+    files_with_space = list(filter(regex.search, files))
+    if files_with_space:
+        logger.warning(
+            'Example file name(s) with space(s) found. Having space(s) in '
+            'file names will break some links. '
+            'List of files: {}'.format(sorted(files_with_space),))
 
 
 def get_default_config_value(key):

diff --git a/sphinx_gallery/tests/test_gen_gallery.py b/sphinx_gallery/tests/test_gen_gallery.py
index 2e636c5..1b1de2e 100644
--- a/sphinx_gallery/tests/test_gen_gallery.py
+++ b/sphinx_gallery/tests/test_gen_gallery.py
@@ -16,6 +16,7 @@ import pytest
 
 from sphinx.errors import ExtensionError
 from sphinx_gallery.gen_gallery import (check_duplicate_filenames,
+                                        check_spaces_in_filenames,
                                         collect_gallery_files,
                                         write_computation_times)
 
@@ -125,7 +126,7 @@ def test_duplicate_files_warn(sphinx_app_wrapper):
     sphinx_app = sphinx_app_wrapper.create_sphinx_app()
 
     files = ['./a/file1.py', './a/file2.py', 'a/file3.py', './b/file1.py']
-    msg = ("Duplicate file name(s) found. Having duplicate file names "
+    msg = ("Duplicate example file name(s) found. Having duplicate file names "
            "will break some links. List of files: {}")
     m = "['./b/file1.py']" if sys.version_info[0] >= 3 else "[u'./b/file1.py']"
 
@@ -140,6 +141,27 @@ def test_duplicate_files_warn(sphinx_app_wrapper):
     assert msg.format(m) in build_warn
 
 
+def test_spaces_in_files_warn(sphinx_app_wrapper):
+    """Test for a exception when an example filename has a space in it."""
+    sphinx_app = sphinx_app_wrapper.create_sphinx_app()
+
+    files = ['./a/file1.py', './a/file2.py', './a/file 3.py']
+    msg = ("Example file name(s) with space(s) found. Having space(s) in "
+           "file names will break some links. "
+           "List of files: {}")
+    m = "['./a/file 3.py']" if sys.version_info[0] >= 3 else "[u'./a/file 3.py']"
+
+    # No warning because no filename with space
+    check_spaces_in_filenames(files[:-1])
+    build_warn = sphinx_app._warning.getvalue()
+    assert build_warn == ''
+
+    # Warning because last file has space
+    check_spaces_in_filenames(files)
+    build_warn = sphinx_app._warning.getvalue()
+    assert msg.format(m) in build_warn
+
+
 def _check_order(sphinx_app, key):
     index_fname = os.path.join(sphinx_app.outdir, '..', 'ex', 'index.rst')
     order = list()

BUG: Spaces in example filenames break image linking
I get to see this in place of the plots. Please guide me where I am wrong.
![screenshot from 2018-12-26 01-18-22](https://user-images.githubusercontent.com/24257914/50426128-554cbb80-08ac-11e9-92ab-5b43842fedd8.png)
Thanks! :)
sphinx_gallery/tests/test_gen_gallery.py::test_collect_gallery_files sphinx_gallery/tests/test_gen_gallery.py::test_collect_gallery_files_ignore_pattern sphinx_gallery/tests/test_gen_gallery.py::test_write_computation_times_noop