You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I injected code using the injector feature to achieve my custom effect, but when my content in one of the posts contains <!-- hexo injector body_begin start>, my custom effect fails. After reviewing the injector source code, I found that the condition in the source code to prevent duplicate insertion caused this issue.
This is my custom effect and code:
I have already proposed a solution in the PR, but it has not been reviewed yet.
Actual behavior
My custom effect failed, and after checking the source code, I found that the injector was not working:
How to reproduce?
Referencing hexo injector body_begin start in the article content.
# Hexo Configurtion## Docs: https://hexo.io/docs/configuration.html## Source: https://github.com/hexojs/hexo/# Sitetitle: mRNA的碎碎念Blogsubtitle: '只要微笑就好了'description: '来自mRNA的学习与生活'keywords:
author: mRNAlanguage: zh-CNtimezone: ''# URL## Set your site url here. For example, if you use GitHub Page, set url as 'https://username.github.io/project'url: http://example.compermalink: :year/:month/:day/:title/permalink_defaults:
pretty_urls:
trailing_index: true # Set to false to remove trailing 'index.html' from permalinkstrailing_html: true # Set to false to remove trailing '.html' from permalinks# Directorysource_dir: sourcepublic_dir: publictag_dir: tagsarchive_dir: archivescategory_dir: categoriescode_dir: downloads/codei18n_dir: :langskip_render:
# Writingnew_post_name: :title.md # File name of new postsdefault_layout: posttitlecase: false # Transform title into titlecaseexternal_link:
enable: true # Open external links in new tabfield: site # Apply to the whole siteexclude: ''filename_case: 0render_drafts: falsepost_asset_folder: falserelative_link: falsefuture: truesyntax_highlighter: highlight.jshighlight:
line_number: trueauto_detect: falsetab_replace: ''wrap: truehljs: falseprismjs:
preprocess: trueline_number: truetab_replace: ''# Home page setting# path: Root path for your blogs index page. (default = '')# per_page: Posts displayed per page. (0 = disable pagination)# order_by: Posts order. (Order by date descending by default)index_generator:
path: ''per_page: 10order_by: -date# Category & Tagdefault_category: uncategorizedcategory_map:
tag_map:
# Metadata elements## https://developer.mozilla.org/en-US/docs/Web/HTML/Element/metameta_generator: true# Date / Time format## Hexo uses Moment.js to parse and display date## You can customize the date format as defined in## http://momentjs.com/docs/#/displaying/format/date_format: YYYY-MM-DDtime_format: HH:mm:ss## updated_option supports 'mtime', 'date', 'empty'updated_option: 'mtime'# Pagination## Set per_page to 0 to disable paginationper_page: 10pagination_dir: page# Include / Exclude file(s)## include:/exclude: options only apply to the 'source/' folderinclude:
exclude:
ignore:
# Extensions## Plugins: https://hexo.io/plugins/## Themes: https://hexo.io/themes/theme: fluid# Deployment## Docs: https://hexo.io/docs/one-command-deploymentdeploy:
- type: gitrepo: [email protected]:mRNA16/mRNA16.github.io.gitbranch: main
- type: gitrepo: [email protected]:/home/git/blog.gitbranch: master#渲染插件marked:
gfm: truepedantic: falsebreaks: truesmartLists: truesmartypants: truequotes: '“”‘’'modifyAnchors: 0anchorAlias: falseautolink: truemangle: truesanitizeUrl: falsedompurify: falseheaderIds: truelazyload: falsefigcaption: falseprependRoot: falsepostAsset: falseexternal_link:
enable: falseexclude: []nofollow: falsedisableNunjucks: falsedescriptionLists: true
Others
No response
The text was updated successfully, but these errors were encountered:
I have made modifications to node_modules/hexo/dist/extend/injector.js locally. Both methods I proposed can solve the above issue. The changes I suggested should fix the bug. Please review my PR.
Check List
hexo version
to check)Expected behavior
I injected code using the injector feature to achieve my custom effect, but when my content in one of the posts contains <!-- hexo injector body_begin start>, my custom effect fails. After reviewing the injector source code, I found that the condition in the source code to prevent duplicate insertion caused this issue.
![1](https://private-user-images.githubusercontent.com/160612195/398156052-cde4c33e-77a5-4dde-a66b-585cfadb3a9a.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk3MDQ0MzAsIm5iZiI6MTczOTcwNDEzMCwicGF0aCI6Ii8xNjA2MTIxOTUvMzk4MTU2MDUyLWNkZTRjMzNlLTc3YTUtNGRkZS1hNjZiLTU4NWNmYWRiM2E5YS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjE2JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxNlQxMTA4NTBaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT00YTIwZGQ2NTNjZjQ1NTg0MGI4NTM4NWI3MDA2ZTVmY2Y1Y2JmY2IzMjAyN2U2Nzc4ZDBkYzlkZDM3MTQ4ODg1JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.tIZkyKOJpUF7YY2OZhZtL83jTEMjrBw0pPaachqz4r8)
This is my custom effect and code:
I have already proposed a solution in the PR, but it has not been reviewed yet.
Actual behavior
My custom effect failed, and after checking the source code, I found that the injector was not working:
![386550400-6e70fa1b-83b2-4f22-ae32-97fe6029da5b](https://private-user-images.githubusercontent.com/160612195/398156297-1a34b8a1-ebef-4415-ac9d-549a186068b9.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk3MDQ0MzAsIm5iZiI6MTczOTcwNDEzMCwicGF0aCI6Ii8xNjA2MTIxOTUvMzk4MTU2Mjk3LTFhMzRiOGExLWViZWYtNDQxNS1hYzlkLTU0OWExODYwNjhiOS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjE2JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxNlQxMTA4NTBaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1lYzQ0YWE2NDE1Y2NlNTk2MDU2ZWZkYTk4YTg1YjVlNmFjNGU0N2YxYzcxNTZmZDBhMTU1ZDlkOTE4NDEyNzkxJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.ep0U7CT7PNxd9mHHGIOrSe4vB_0h9mE2H8JRgT4SP9w)
How to reproduce?
Is the problem still there under
Safe mode
?yes
Your Node.js & npm version
Your Hexo and Plugin version
Your
package.json
Your site's
_config.yml
(Optional)Others
No response
The text was updated successfully, but these errors were encountered: