mirror of
https://github.com/lunaisnotaboy/mastodon.git
synced 2024-12-20 04:07:45 +00:00
Merge pull request #1778 from ClearlyClaire/glitch-soc/fixes/code-block-indentation
Fix leading spaces being stripped in Markdown code blocks
This commit is contained in:
commit
c279dbd470
|
@ -8,7 +8,7 @@ class AdvancedTextFormatter < TextFormatter
|
|||
end
|
||||
|
||||
def block_code(code, _language)
|
||||
<<~HTML.squish
|
||||
<<~HTML
|
||||
<pre><code>#{ERB::Util.h(code).gsub("\n", '<br/>')}</code></pre>
|
||||
HTML
|
||||
end
|
||||
|
|
|
@ -40,6 +40,10 @@ RSpec.describe AdvancedTextFormatter do
|
|||
it 'formats code using <pre> and <code>' do
|
||||
is_expected.to include '<pre><code>int main'
|
||||
end
|
||||
|
||||
it 'does not strip leading spaces' do
|
||||
is_expected.to include '> return 0'
|
||||
end
|
||||
end
|
||||
|
||||
context 'given some quote' do
|
||||
|
|
Loading…
Reference in a new issue