Backport #29260 by @yp05327
Fix#29136
Before:
The result is a table and all line numbers are all in one row.


After:


~~Updated:~~
~~added `active` class to the target line.~~

Co-authored-by: yp05327 <576951401@qq.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
(cherry picked from commit 9db426ad8c7122633fa3e31a427fd1e65ddad334)