mirror of
https://git.bsd.gay/fef/nyastodon.git
synced 2024-12-25 21:23:42 +01:00
Fix code blocks processing
This commit is contained in:
parent
61cefbebf7
commit
8d6f3f8a37
2 changed files with 9 additions and 1 deletions
|
@ -9,7 +9,7 @@ class AdvancedTextFormatter < TextFormatter
|
|||
|
||||
def block_code(code, _language)
|
||||
<<~HTML.squish
|
||||
<pre><code>#{h(code).gsub("\n", '<br/>')}</code></pre>
|
||||
<pre><code>#{ERB::Util.h(code).gsub("\n", '<br/>')}</code></pre>
|
||||
HTML
|
||||
end
|
||||
|
||||
|
|
|
@ -34,6 +34,14 @@ RSpec.describe AdvancedTextFormatter do
|
|||
end
|
||||
end
|
||||
|
||||
context 'given a block code' do
|
||||
let(:text) { "test\n\n```\nint main(void) {\n return 0;\n}\n```\n" }
|
||||
|
||||
it 'formats code using <pre> and <code>' do
|
||||
is_expected.to include '<pre><code>int main'
|
||||
end
|
||||
end
|
||||
|
||||
context 'given some quote' do
|
||||
let(:text) { "> foo\n\nbar" }
|
||||
|
||||
|
|
Loading…
Reference in a new issue