jrblevin / markdown-mode

Emacs Markdown Mode
http://jblevins.org/projects/markdown-mode/
GNU General Public License v3.0
875 stars 160 forks source link

Code Block Background Color only where text is #794

Closed phuhl closed 10 months ago

phuhl commented 10 months ago

Expected Behavior

Org mode and most online Markdown visualizations show the background color for code blocks full width:

Org-mode: image

Markdown rendered by Github: image

Also, I personally find it easier to work with code in a block that is full width colorized.

Actual Behavior

Currently markdown mode applies markdown-pre-face only where text is within a code block:

image

Should this be intended behavior, maybe a feature flag could be added to switch between viewing modes for code blocks.

Steps to Reproduce

  1. Set a background color to markdown-pre-face that is different from the rest: (custom-set-faces `(markdown-pre-face ((t :background "#ff0000"))))
  2. Create code block in md mode

Backtrace

n/a

Software Versions

syohex commented 10 months ago

Could you try to use :extend attribute as the below sample, please ?

(set-face-attribute 'markdown-pre-face nil
                    :foreground "black" :background "white" :weight 'bold
                    :extend t)

This is a screenshot that sets extend attribute

image

phuhl commented 10 months ago

That solved the issue, thank you!

phuhl commented 10 months ago

Interestingly, for code blocks through indentation, this seems to resolve the issue only for every line but the last: image

Any idea how this could be resolved?

syohex commented 10 months ago

It's impossible with the current implementation. I'm checking whether we can fix that and its side effects

syohex commented 10 months ago

I have merged #796. Please check latest version.

phuhl commented 10 months ago

Seems like it works. Thanks again!