NodeBB / NodeBB/nodebb-plugin-markdown

Spurious {1} inserted into autodetect code highlighting when numbering enabled.

オープン
#167 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
JavaScript
スター
33
フォーク
41
平均マージ
3時間 40分
マージ済み PR(30日)
4

説明

There is a bug where specific words in a code block set to use line numbering will cause some empty following lines to have spurious {1} text inserted in it. e.g.:
image

this can be confirmed by inspecting the <code class> element it will be set to hljs sql for blocks with this issue and hljs perl or other wise for blocks of code without this issue.

This only happens if the code language is autodetected as SQL (hence why the specific words are needed to trigger the highlight.js autodetection for SQL). if the language type is set to SQL or any other type it does not happen:

image

If line numbering for SQL is turned off in the markdown plugin settings it does not happen:
image
(note no line numbering, no {1})

So we can work around this issue by just not having line numbering for SQL as we don't post SQL frequently/at all on our forum.

Versions:

NodeBB version: 1.18.5 (although we have had this issue from at least 1.16)
Markdown plugin version: 8.14.4

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、行番号を有効にした自動検出 SQL コードブロックを使って Markdown プラグインで問題を再現し、その後、コードハイライトと行番号付けの統合を調査します。SQL の自動検出によって空の後続行に不要な {1} テキストが挿入されなくなり、明示的な SQL ハイライトと他の言語に影響がないことを確認できれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript
領域
frontend
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。