vuepress-reco / vuepress-theme-reco

🎨 This is the repo for vuepress-theme-reco 2.
https://vuepress-theme-reco.recoluan.com
MIT License
540 stars 175 forks source link

fix: 修复frontmatter值转换的错误 #55

Closed ischanx closed 2 years ago

ischanx commented 2 years ago

MR摘要 修复frontmatter值转换的错误,拿categories和tags举例

categories:
 - false
 - undefined
 - null
 - 123
 - ''
 - 
tags:
 - false
 - undefined
 - null
 - 123
 - ''
 - 

详细说明

  1. 纯数字,布尔值,undefined,null,不填写值等情况会导致拼音转换错误,编译失败

    // 如null
    TypeError: Cannot read properties of null (reading 'split')
    at Object.convertToPinyin (D:\front-end\vuepress-theme-reco\packages\@vuepress-reco\shared\lib\cjs\helpers\toPinYin.js:19:27) 
  2. 空字符串可以通过拼音转换,但是会出现空tag,空category image

ischanx commented 2 years ago

可能同时修复 #32 的场景,我不确定