vuejs / vitepress

Vite & Vue powered static site generator.
https://vitepress.dev
MIT License
12.6k stars 2.05k forks source link

Prohibit parsing<>tags in markdown #4216

Open xuanyulevel6 opened 5 hours ago

xuanyulevel6 commented 5 hours ago

Is your feature request related to a problem? Please describe.

When I ported my MD document over, I encountered many problems and found that it was due to some<>tags being incorrectly parsed (in fact, I didn't want them to be parsed). This has caused some trouble. The example is as follows:

| 参数              | 含义                                               |
| ----------------- | -------------------------------------------------- |
| -d                | 指定当前唯一通过 USB 连接的 Android 设备为命令目标 |
| -e                | 指定当前唯一运行的模拟器为命令目标                 |
| -s <serialNumber>| 指定相应 serialNumber 号的设备/模拟器为命令目标    |

An error will be reported at this time:[plugin:vite:vue] Element is missing end tag.

Although it can be solved by :| -s `<serialNumber>`|  ,

Describe the solution you'd like

I think simply prohibit parsing<>in the table, is the simplest and most effective approach.I want to know how to disable parsing in a table.

Because I hope that documents that can be parsed normally in MD software such as Typora can be easily ported. The parsing of tags has caused some trouble.

Describe alternatives you've considered

Perhaps globally banning the "Using Vue in Markdown" feature would also be effective?

Additional context

No response

Validations

xuanyulevel6 commented 4 hours ago

I have seen a similar solution, but it is not what I expected(and not work). Can it be changed to prohibit all Vue syntax parsing in the table?

  markdown: {
    config: (md) => {
      const render = md.render
      md.render = function (src, env) {
        return `<div v-pre>${render.call(this, src, env)}</div>`
      }
    },
    attrs: 'false',
    html: 'false',
  },