Howdy hey. So I'm running into this problem when using the alternate hexo-renderer-markdown-it renderer with the markdown-it-include plugin.
My setup is as follows:
My template index.ejs looks like this:
<!-- index.ejs -->
<h1> Some h1 </h1>
<%- page.content %>
My index.md page looks like this (note the custom syntax provided by the markdown-it plugin):
---
title: API Reference
---
## Some h2
!!! include(source/includes/somePartial.md) !!!
And somePartial.md looks like this:
### Some h3
The configuration works great when index.md gets modified. But if I modify somePartial.md the cache doesn't get invalidated and I see the stale content that previously was in somePartial.md. The only way to see the new content is to delete db.json or modify index.md. Note that modify index.ejs does not allow me to see the new content.
Is there any workaround I can do to fix this? I think the problem is the nested including, where the markdown file is itself including a partial.
Run hexo clean could remove all caches. I believe this is similar to changing a theme layout, Hexo monitors adding new files, but for existing files, it uses the cache to improve the performance.
Hexo clean does destroy db.json, which causes the the cache to be regenerated (and update the stale content). But I have to do this every time I want to see the fresh content. There needs to be a way to invalidate the cache for index.md when somePartial.md changes.
Have you tried the hexo-browsersync plugin? Which allow viewing the changes on the fly, but I'm not sure if it works with the nested include.
Tried it. It does reload the page, but since the cache is invalid and it doesn't know it, it still shows the stale page.
@scottmas
I published the following plugin. Please use it if you like.
https://github.com/tea3/hexo-include-markdown
This issue has been automatically marked as stale because lack of recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Most helpful comment
@scottmas
I published the following plugin. Please use it if you like.
https://github.com/tea3/hexo-include-markdown