Skip to content

Hexo altering Javascript files on generate #1591

@ricardojmendez

Description

@ricardojmendez

On generate, Hexo is altering highlight.pack.js unnecessarily, breaking it.

To reproduce:

  • Copy the file to your source folder
  • hexo generate

You'll see that line 31, which on the original file is

return value.replace(/&/gm, '&amp;').replace(/</gm, '&lt;').replace(/>/gm, '&gt;');

Is converted to:

return value.replace(/&/gm, '&amp;').replace(//gm, '&gt;');

Installed packages:

{
  "name": "hexo-site",
  "hexo": {
    "version": "3.1.1"
  },
  "private": true,
  "dependencies": {
    "hexo": "^3.1.1",
    "hexo-generator-archive": "^0.1.1",
    "hexo-generator-category": "^0.1.1",
    "hexo-generator-feed": "^1.0.2",
    "hexo-generator-index": "^0.1.0",
    "hexo-generator-minify": "^0.1.0",
    "hexo-generator-tag": "^0.1.0",
    "hexo-renderer-ejs": "*",
    "hexo-renderer-marked": "^0.2.5",
    "hexo-renderer-stylus": "*",
    "hexo-server": "^0.1.2"
  }
}

I've yet to determine if it's one of the renderers that's causing the issue.

Attaching .js file as a .txt, since Github does not support .js attachments.

highlight.pack.js.txt

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions