mirror of
https://github.com/SharpeTronics/jekyll-spaceship.git
synced 2025-12-17 00:03:13 -05:00
fix: math expression within pipline broken (#14)
This commit is contained in:
parent
68cc44e2bd
commit
a3a1cc2b88
@ -158,7 +158,7 @@ module Jekyll::Spaceship
|
||||
if type == :code
|
||||
regex = /((`+)\s*(\w*)((?:.|\n)*?)\2)/
|
||||
elsif type == :math
|
||||
regex = /(?<=^|\n)[^\n\|]*(((?<!\\)\${1,2})[^\n]*\2)[^\n\|]*/
|
||||
regex = /(((?<!\\)\${1,2})[^\n]*?\1)/
|
||||
end
|
||||
next if regex.nil?
|
||||
content.scan(regex) do |match_data|
|
||||
|
||||
@ -8,7 +8,7 @@ module Jekyll::Spaceship
|
||||
def on_handle_markdown(content)
|
||||
# pre-handle reference-style links
|
||||
references = {}
|
||||
content.scan(/(\[(.*)\]:\s*(.*))/) do |match_data|
|
||||
content.scan(/\n\s*(\[(.*)\]:\s*(\S+(\s+".*?")?))/) do |match_data|
|
||||
ref_name = match_data[1]
|
||||
ref_value = match_data[2]
|
||||
references[ref_name] = ref_value
|
||||
@ -33,9 +33,12 @@ module Jekyll::Spaceship
|
||||
|
||||
# escape * and _ and $ etc.
|
||||
content.scan(/[^\n]*(?<!\\)\|[^\n]*/) do |result|
|
||||
# skip for math expression within pipeline
|
||||
next unless result
|
||||
.gsub(/((?<!\\)\${1,2})[^\n]*?\1/, '')
|
||||
.match(/(?<!\\)\|/)
|
||||
replace = result.gsub(
|
||||
/(?<!(?<!\\)\\)(\*|\$|\[|\(|\"|_)/,
|
||||
'\\\\\\\\\1')
|
||||
/(?<!(?<!\\)\\)(\*|\$|\[|\(|\"|_)/, '\\\\\\\\\1')
|
||||
next if result == replace
|
||||
content = content.gsub(result, replace)
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user