rosscdh / mkdocs-markdownextradata-plugin

A MkDocs plugin that injects the mkdocs.yml extra variables into the markdown template
MIT License
83 stars 18 forks source link

json support broken #15

Closed AlexH-HankIT closed 4 years ago

AlexH-HankIT commented 4 years ago

Version: 0.1.3 Python: Python 3.8.2 OS: Windows 10

Since the content of the json file is read using read_bytes(), json.loads() rather than json.load() should be used: https://github.com/rosscdh/mkdocs-markdownextradata-plugin/blob/master/markdownextradata/plugin.py#L82

With json.load() i'm receiving an error:

AttributeError: 'bytes' object has no attribute 'read'

When I update the method call to json.loads() it works as expected.

I can create a pull request, if required.

rosscdh commented 4 years ago

Thanks! please feel free to make a pr and a test would be great

On Wed, Apr 29, 2020 at 5:27 AM Alex H notifications@github.com wrote:

Version: 0.1.3 Python: Python 3.8.2 OS: Windows 10

Since the content of the json file is read using read_bytes(), json.loads() rather than json.load() should be used:

https://github.com/rosscdh/mkdocs-markdownextradata-plugin/blob/master/markdownextradata/plugin.py#L82

With json.load() i'm receiving an error:

AttributeError: 'bytes' object has no attribute 'read'

When I update the method call to json.loads() it works as expected.

I can create a pull request, if required.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/rosscdh/mkdocs-markdownextradata-plugin/issues/15, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADA6MSUL65AYJGJ275O2IDRO6NB7ANCNFSM4MTLSMTQ .

peterw-ibm commented 4 years ago

Running into the same issue.

rosscdh commented 4 years ago

fixed btw in latest version