Skip to content

Commit 536896d

Browse files
committed
reverted to on_page_markdown
1 parent 35e9128 commit 536896d

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

‎markdownextradata/plugin.py‎

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -88,16 +88,8 @@ def on_pre_build(self, config):
8888
),
8989
)
9090

91-
def on_page_read_source(self, page, config, **kwargs):
91+
def on_page_markdown(self, markdown, config, **kwargs):
9292
context = {key: config.get(key) for key in CONFIG_KEYS if key in config}
9393
context.update(config.get("extra", {}))
94-
try:
95-
with open(page.file.abs_src_path, 'r', encoding='utf-8-sig', errors='strict') as f:
96-
md_template = Template(f.read())
97-
return md_template.render(**config.get("extra"))
98-
except OSError:
99-
log.error('File not found: {}'.format(self.file.src_path))
100-
raise
101-
except ValueError:
102-
log.error('Encoding error reading file: {}'.format(self.file.src_path))
103-
raise
94+
md_template = Template(markdown)
95+
return md_template.render(**config.get("extra"))

0 commit comments

Comments
 (0)