Skip to content

meta标签中的元数据没有做HTML转义 #883

@frezcirno

Description

@frezcirno

Issue Checklist

Expected behavior

文章中的元数据(如标题、描述、标签等)没有正确转义,导致HTML或特殊字符直接输出,影响页面结构

Actual behavior

如下Markdown样例,输出时 <meta content="..."> 中的内容不会转义,会导致HTML结果错乱

---
title: 测试 "Test"
description:  测试 "Test"
---

Steps to reproduce the behavior

新建一个markdown文档

---
title: 测试 "Test"
description:  测试 "Test"
---

渲染,输出的HTML(仅有问题的部分):

        <article itemscope itemtype="http://schema.org/Article" class="post-content" lang="zh-CN">
          <span hidden itemprop="post" itemscope itemtype="http://schema.org/CreativeWork">
            <meta itemprop="name" content="测试 " Test" | My Blog">   <!-- 这里 -->
            <meta itemprop="description" content="测试 " Test"">    <!-- 和这里 -->
          </span>

Node.js and NPM Information

v18.20.5
10.8.2

Package dependencies Information

hexo-site@1.0.0 /home/frezcirno/src/test
├── @renbaoshuo/markdown-it-katex@2.0.2
├── gulp-clean-css@4.3.0
├── gulp-cli@3.0.0
├── gulp-html-minifier-terser@7.1.0
├── gulp-htmlclean@2.7.22
├── gulp-replace@1.1.4
├── gulp-terser@2.1.0
├── gulp@5.0.0
├── hexo-algolia@1.3.2
├── hexo-directory-category@1.1.4
├── hexo-excerpt@1.3.1
├── hexo-front-matter-excerpt@0.2.0
├── hexo-generator-archive@2.0.0
├── hexo-generator-category@2.0.0
├── hexo-generator-index@4.0.0
├── hexo-generator-searchdb@1.4.1
├── hexo-generator-sitemap@3.0.1
├── hexo-generator-tag@2.0.0
├── hexo-hide-posts@0.4.3
├── hexo-image-link@0.0.6 -> ./themes/hexo-image-link
├── hexo-optimize@3.3.0
├── hexo-related-posts@1.6.2
├── hexo-renderer-ejs@2.0.0
├── hexo-renderer-markdown-it@7.1.1
├── hexo-renderer-stylus@3.0.1
├── hexo-server@3.0.0
├── hexo-symbols-count-time@0.7.1
├── hexo-theme-next@8.22.0
├── hexo-word-counter@0.2.0
├── hexo@7.3.0
├── katex@0.16.21
└── markdown-it-wikilinks@1.4.0

Hexo Configuration

--应该没关系

NexT Configuration

--应该没关系

Other Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething isn't workingSolved

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions