Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

是否可添加一个跟vitepress一样的code代码块里面某些行代码进行突出显示? #615

Closed
wskaudh opened this issue Jun 6, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@wskaudh
Copy link

wskaudh commented Jun 6, 2024

参考链接是vitepress官方说明https://vitepress.dev/guide/markdown#line-highlighting-in-code-blocks
代码块中的行高亮功能

export default {
  data () {
    return {
      msg: 'Highlighted!'
    }
  }
}

使用js{4}来高亮第4行代码

@obgnail
Copy link
Owner

obgnail commented Jun 6, 2024

@wskaudh

你好,感谢反馈。

首先,功能肯定是能做的。

但是现在有一个很尴尬的点,Typora 在解析 language 的时候,会自动过滤掉 {}。导致 js{2} 变成 js2

所以这个需求可能需要改变高亮行的约定,比如 js{2} 改成 js(2) 之类的。

img_2024-06-07_02-00-45

@obgnail
Copy link
Owner

obgnail commented Jun 18, 2024

@wskaudh

你好,功能已经实现。麻烦升级到最新版本试用一下。

  1. 新增了 HIGHLIGHT_BY_LANGUAGE 选项(此功能默认关闭,需要手动修改配置文件,将其置为 true)
  2. 如上述所言,我修改了高亮行的约定,将 js{2} 改成 js(2)

@obgnail obgnail added the enhancement New feature or request label Jun 18, 2024
@obgnail
Copy link
Owner

obgnail commented Jun 18, 2024

此 issue 关闭,如有问题麻烦在下面留言或另开 issue。

@obgnail obgnail closed this as completed Jun 18, 2024
@wskaudh
Copy link
Author

wskaudh commented Jun 19, 2024

好的,非常感謝,我嘗試一下這個功能。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants