Skip to content

Code blocks in HTML comments were incorrectly converted #5433

@FZQ0003

Description

@FZQ0003

Check List

  • I have already read Docs page & Troubleshooting page.
  • I have already searched existing issues and they are not help to me.
  • I examined error or warning messages and it's difficult to solve.
  • I am using the latest version of Hexo. (run hexo version to check)
  • My Node.js is matched the required version.

Expected behavior

In my old blog directory (replaced theme with landscape):

image

Output:

<p>Text 1</p>
<!--

Commented text 1

    ```
    A commented code block
    ```

Commented text 2

-->
<p>Text 2</p>

Actual behavior

In my newly installed blog directory:

image

Output:

<p>Text 1</p>
<!--

Commented text 1

<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">A commented code block</span><br></pre></td></tr></table></figure>

<p>Commented text 2</p>
<p>–&gt;</p>
<p>Text 2</p>

...
</html>-->

How to reproduce?

Write a post like this and then start the server:

---
title: Test
layout: post
---

Text 1

<!--

Commented text 1

    ```
    A commented code block
    ```

Commented text 2

-->

Text 2

Is the problem still there under Safe mode?

Cannot generate pages under safe mode.

Your Node.js & npm version

v21.6.1
10.5.0

Your Hexo and Plugin version

[email protected] D:\Server\hexo-blog-src
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]

Your package.json

{
  "name": "hexo-blog-fqilin",
  "version": "0.0.0",
  "private": true,
  "scripts": {
    "build": "hexo generate",
    "clean": "hexo clean",
    "deploy": "hexo deploy",
    "server": "hexo server"
  },
  "hexo": {
    "version": "7.1.1"
  },
  "dependencies": {
    "hexo": "^7.0.0",
    "hexo-generator-archive": "^2.0.0",
    "hexo-generator-category": "^2.0.0",
    "hexo-generator-index": "^3.0.0",
    "hexo-generator-tag": "^2.0.0",
    "hexo-renderer-ejs": "^2.0.0",
    "hexo-renderer-marked": "^6.0.0",
    "hexo-renderer-stylus": "^3.0.0",
    "hexo-server": "^3.0.0",
    "hexo-theme-fluid": "^1.9.7",
    "hexo-theme-landscape": "^1.0.0"
  }
}

Your site's _config.yml (Optional)

No response

Others

Additionally, here is a list of plugins used in my OLD environment:

When I was trying to setup a new environment, this issue appeared. I don't know why.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions