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>