obsidian-code-block-enhancer icon indicating copy to clipboard operation
obsidian-code-block-enhancer copied to clipboard

Bug: Line numbers do not line up accurately with actual code lines.

Open swehba opened this issue 3 years ago • 6 comments

I'm not sure if this is something new or it has always been a problem, but I have used this excellent plugin for a while and have only just now noticed the problem. Anyway, in Preview mode, the line numbers are slightly below the lines they refer to. See https://cln.sh/nmZLl9+.

swehba avatar Nov 22 '21 18:11 swehba

I am having the same problem. In my tests, it does not seems to be styling from anything else. The bare plugin alone has this issue.

Thank you

Hunanbean avatar Jan 13 '22 19:01 Hunanbean

seeing this issue too.

by the time you get to the bottom of the code block, there are 4 or 5 lines that do not appear to have line numbers

image

I presume that this can be fixed by modifying the line spacing/font sizing of the actual code, but I am unsure how to resolve this myself.

toro- avatar Feb 26 '22 09:02 toro-

Maybe this might help someone.

I changed line 59 in style.css from: top: 1em; to: top: 0.5em;

Screenshots of ~/path_to/.obsidian/plugins/obsidian-code-block-enhancer/styles.css taken from Obsidian showing passable/usuable/close enough-able line numbers.

image image

berty-b avatar Nov 10 '22 13:11 berty-b

@berty-b Thanks, it works fine! But language name is hidden...

hkcomori avatar Jan 04 '23 12:01 hkcomori

@hkcomori

I commented line 27 in style.css from: position: absolute; to: /* position: absolute; */

Screenshot of ~/path_to/.obsidian/plugins/obsidian-code-block-enhancer/styles.css taken from Obsidian showing language name at the bottom.

image

berty-b avatar Jan 11 '23 20:01 berty-b

@berty-b Thanks for the suggestion, but I no longer see the problem with misaligned line numbers. It must have been fixed somewhere along the way.

swehba avatar Jan 11 '23 22:01 swehba