Skip to content

Commit

Permalink
Updating render_code function to have fallback for nil lexer
Browse files Browse the repository at this point in the history
  • Loading branch information
skduncan committed Sep 9, 2024
1 parent 328fc93 commit 4e8ab3b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions playbook-website/lib/markdown_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ def self.cache_key(text)
def render_code(text, language)
formatter = Rouge::Formatters::HTML.new(scope: ".highlight")
lexer = Rouge::Lexer.find(language)

lexer = Rouge::Lexers::PlainText.new if lexer.nil?

formatter.format(lexer.lex(text))
end

Expand Down

0 comments on commit 4e8ab3b

Please sign in to comment.