Description -as\r\n [code]a = b+ 4\r\nc= a +j\r\n\r\n[/code]\r\nagain text\r\n[code]a = c + 4\r\n[/code]"
output i need is to pass the text enclosed in [code] to coderay for formatting. or you can say as similar to stackoverflow where we can see code part and text part separated . i am following Separate Code blocks form text which is working if code block is with in one line.
You can use this to avoid the newline problem:
str.gsub(/\[code\]((?>[^\[]++|\[(?!\/code]))*+)\[\/code\]/) do |match, replace|
...
The content enclosed between [code]
tags is in the first capturing group.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.