Repository: aklajnert/mkdocs-simple-hooks (language: python)

Issue:
Invalid config option
Hi! I like the idea of your plugin but it doesn't work that way for me.

I tried your sample code and get the following error:

```
ERROR   -  Config value: 'plugins'. Error: Plugin value: 'hooks'. Error: Expected type: <class 'dict'> but received: <class 'list'>
```

My config:
```
# Plugins
plugins:
  - mkdocs-simple-hooks:
      hooks:
        - on_pre_build: "docs.hooks:copy_readme"
```
I am using the latest plugin version (0.1.1), mkdocs  1.1.2, python 3.7 64bit

If i debug into your plugin there seems to be something wrong how the hook config value is read:
```
[{'on_pre_build': 'docs.hooks:copy_readme'}]
> special variables
> function variables
> 0:{'on_pre_build': 'docs.hooks:copy_readme'}
> len():1
```

Do you know what could be wrong in my configuration? It seems that the codes workes for you?



Discussion / hints:
Oh, it seems like I've made a mistake in the documentation. As the error message says - it expected dict for hooks declaration, but a list of dicts has been provided instead.

Change this:
```yaml
# Plugins
plugins:
  - mkdocs-simple-hooks:
      hooks:
        - on_pre_build: "docs.hooks:copy_readme"
```

To this:  
```yaml
# Plugins
plugins:
  - mkdocs-simple-hooks:
      hooks:
        on_pre_build: "docs.hooks:copy_readme"  # <-- no dash here
```

I'll fix the readme later.

Fix patch:
diff --git a/README.md b/README.md
index b36d9ae..1c511c1 100644
--- a/README.md
+++ b/README.md
@@ -17,7 +17,7 @@ plugins:
   - search
   - mkdocs-simple-hooks:
       hooks:
-        - hook-name: "your.module:hook_function"
+        hook-name: "your.module:hook_function"
 ```
 
 > If you have no `plugins` entry in your config file yet, you'll likely also want to add the `search` plugin. MkDocs enables it by default if there is no `plugins` entry set.
@@ -51,7 +51,7 @@ Now, register the hook in your `mkdocs.yml`:
 plugins:
   - mkdocs-simple-hooks:
       hooks:
-        - on_pre_build: "docs.hooks:copy_readme"
+        on_pre_build: "docs.hooks:copy_readme"
 ```
 
 That's all - the `copy_readme()` function will run every time, before building the documentation.  
diff --git a/noxfile.py b/noxfile.py
index 87e775b..25f2015 100644
--- a/noxfile.py
+++ b/noxfile.py
@@ -12,7 +12,7 @@ def tests(session):
 @nox.session
 def flake8(session):
     session.install("flake8")
-    session.run("flake8", "mkdocs_simple_hooks", "tests")
+    session.run("flake8", "mkdocs_simple_hooks", "tests.py")
 
 
 @nox.session
diff --git a/setup.cfg b/setup.cfg
index e3a2867..3053968 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,2 +1,3 @@
 [flake8]
 max-line-length = 89
+ignore=E231


Test patch:
diff --git a/tests.py b/tests.py
index 297fb27..24656bf 100644
--- a/tests.py
+++ b/tests.py
@@ -28,8 +28,8 @@ def test_no_hooks_defined(tmpdir, monkeypatch):
     result = runner.invoke(build_command)
     assert result.exit_code == 0
     assert (
-        "Warning: No hooks defined. The mkdocs-simple-hooks plugin will not run anything."
-        in result.output
+        "Warning: No hooks defined. "
+        "The mkdocs-simple-hooks plugin will not run anything." in result.output
     )
 
 
@@ -65,7 +65,8 @@ def test_no_attribute(tmpdir, monkeypatch):
     result = runner.invoke(build_command)
     assert result.exit_code == 0
     assert (
-        "Config value: 'plugins'. Warning: Module 'no_attribute.hooks' doesn't have attribute 'on_pre_build'"
+        "Config value: 'plugins'. "
+        "Warning: Module 'no_attribute.hooks' doesn't have attribute 'on_pre_build'"
         in result.output
     )