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

highlight(lang, code, ...args) has been deprecated. #245

Closed
njzjz opened this issue Mar 24, 2021 · 4 comments · Fixed by #246
Closed

highlight(lang, code, ...args) has been deprecated. #245

njzjz opened this issue Mar 24, 2021 · 4 comments · Fixed by #246

Comments

@njzjz
Copy link

njzjz commented Mar 24, 2021

Deprecated as of 10.7.0. highlight(lang, code, ...args) has been deprecated.
Deprecated as of 10.7.0. Please use highlight(code, options) instead.
highlightjs/highlight.js#2277


result = hljs.highlight(lang, lines.shift(), false, result.top);

@V-Vincen
Copy link

V-Vincen commented Apr 3, 2021

在 hexo 升级到 5.4.0 后,出现了该问题。是否去 node_modules/hexo-util/lib/highlight.js 文件,修改

result = hljs.highlight(lang, lines.shift(), false, result.top); 

result = hljs.highlight(lines.shift(), {
        language: lang,
        ignoreIllegals: false
      }, result.top);

修改完成后,当我 hexo g 时,还是出现了 highlight 已过时的提示。希望能够得到你的回复帮助。万分感谢。

@rangerzhou
Copy link

在 hexo 升级到 5.4.0 后,出现了该问题。是否去 node_modules/hexo-util/lib/highlight.js 文件,修改

result = hljs.highlight(lang, lines.shift(), false, result.top); 

result = hljs.highlight(lines.shift(), {
        language: lang,
        ignoreIllegals: false
      }, result.top);

修改完成后,当我 hexo g 时,还是出现了 highlight 已过时的提示。希望能够得到你的回复帮助。万分感谢。

$ grep -irns "highlight(lang" .
./node_modules/hexo-util/lib/highlight.js:141:  if (options.hljs) return hljs.highlight(lang, str);
./node_modules/hexo-util/lib/highlight.js:151:    var result = hljs.highlight(lang, lines.shift());
./node_modules/hexo-util/lib/highlight.js:154:      result = hljs.highlight(lang, lines.shift(), false, result.top);
./node_modules/hexo-deployer-git/node_modules/hexo-util/lib/highlight.js:135:    let result = hljs.highlight(lang, lines.shift());
./node_modules/hexo-deployer-git/node_modules/hexo-util/lib/highlight.js:138:      result = hljs.highlight(lang, lines.shift(), false, result.top);
./node_modules/hexo-deployer-git/node_modules/highlight.js/lib/core.js:1537:  function shouldNotHighlight(languageName) {
./node_modules/hexo-deployer-git/node_modules/highlight.js/lib/core.js:1569:   * highlight(lang, code, ignoreIllegals, continuation)
./node_modules/hexo-deployer-git/node_modules/highlight.js/lib/core.js:1599:      deprecated("10.7.0", "highlight(lang, code, ...args) has been deprecated.");
./node_modules/hexo-deployer-git/node_modules/highlight.js/lib/core.js:1636:  function _highlight(languageName, codeToHighlight, ignoreIllegals, continuation) {
./node_modules/hexo-deployer-git/node_modules/highlight.js/lib/core.js:2196:    if (shouldNotHighlight(language)) return;
./node_modules/hexo/node_modules/hexo-util/lib/highlight.js:135:    let result = hljs.highlight(lang, lines.shift());
./node_modules/hexo/node_modules/hexo-util/lib/highlight.js:138:      result = hljs.highlight(lang, lines.shift(), false, result.top);
./node_modules/hexo/node_modules/highlight.js/lib/core.js:1537:  function shouldNotHighlight(languageName) {
./node_modules/hexo/node_modules/highlight.js/lib/core.js:1569:   * highlight(lang, code, ignoreIllegals, continuation)
./node_modules/hexo/node_modules/highlight.js/lib/core.js:1599:      deprecated("10.7.0", "highlight(lang, code, ...args) has been deprecated.");
./node_modules/hexo/node_modules/highlight.js/lib/core.js:1636:  function _highlight(languageName, codeToHighlight, ignoreIllegals, continuation) {
./node_modules/hexo/node_modules/highlight.js/lib/core.js:2196:    if (shouldNotHighlight(language)) return;
./node_modules/highlight.js/lib/highlight.js:882:    result = language ? highlight(language, text, true) : highlightAuto(text);
./node_modules/hexo-cli/node_modules/hexo-util/lib/highlight.js:135:    let result = hljs.highlight(lang, lines.shift());
./node_modules/hexo-cli/node_modules/hexo-util/lib/highlight.js:138:      result = hljs.highlight(lang, lines.shift(), false, result.top);
./node_modules/hexo-cli/node_modules/highlight.js/lib/core.js:1537:  function shouldNotHighlight(languageName) {
./node_modules/hexo-cli/node_modules/highlight.js/lib/core.js:1569:   * highlight(lang, code, ignoreIllegals, continuation)
./node_modules/hexo-cli/node_modules/highlight.js/lib/core.js:1599:      deprecated("10.7.0", "highlight(lang, code, ...args) has been deprecated.");
./node_modules/hexo-cli/node_modules/highlight.js/lib/core.js:1636:  function _highlight(languageName, codeToHighlight, ignoreIllegals, continuation) {
./node_modules/hexo-cli/node_modules/highlight.js/lib/core.js:2196:    if (shouldNotHighlight(language)) return;

Several place use this interface, maybe need to change all, lan de zhe teng le!!!

@duchengyao
Copy link

不改会有影响吗

@SuiteLHY
Copy link

SuiteLHY commented May 24, 2021

不改会有影响吗

When building a cloud platform, such as Travis CI I used, the log is too long due to the API expiration prompt, and the final build always fails.
------------------------------------------------------------------(译文)---------------------------------------------------------------
云平台构建的时候,比如我用的 Travis CI,因为这个 API 过期提示导致的日志过长,最后构建总是失败。

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

Successfully merging a pull request may close this issue.

5 participants