laravel: fix codes being squashed (fixes #1852)

This commit is contained in:
TK Lai 2023-05-14 14:38:04 +08:00
parent 0cc5933b7e
commit 2e236f5533

View file

@ -9,9 +9,16 @@ module Docs
end
# Remove code highlighting
css('pre').each do |node|
node.content = node.content
node['data-language'] = 'php'
css('pre > code').each do |node|
if node['data-lang'].eql?('nothing')
# Ignore 'nothing' language
else
node.parent['data-language'] = node['data-lang']
end
# Prism uses `\n` to determine lines. Otherwise the lines will be
# compacted.
node.parent.content = node.css('.line').map(&:content).join("\n")
node.remove
end
doc