Class: ActionTextSyntaxHighlighter::HighlightedCodeBlock
- Inherits:
-
ApplicationRecord
- Object
- ApplicationRecord
- ActionTextSyntaxHighlighter::HighlightedCodeBlock
show all
- Includes:
- ActionText::Attachable, SupportedLanguages
- Defined in:
- app/models/action_text_syntax_highlighter/highlighted_code_block.rb
Defined Under Namespace
Modules: SupportedLanguages
Instance Method Summary
collapse
Instance Method Details
#content_type ⇒ Object
24
25
26
|
# File 'app/models/action_text_syntax_highlighter/highlighted_code_block.rb', line 24
def content_type
"text/html"
end
|
#highlighted_content ⇒ Object
18
19
20
21
22
|
# File 'app/models/action_text_syntax_highlighter/highlighted_code_block.rb', line 18
def highlighted_content
return content unless lexer.present?
highlighter.format(lexer.lex(content)).html_safe
end
|
#language ⇒ Object
14
15
16
|
# File 'app/models/action_text_syntax_highlighter/highlighted_code_block.rb', line 14
def language
super || ""
end
|
#to_trix_content_attachment_partial_path ⇒ Object
28
29
30
|
# File 'app/models/action_text_syntax_highlighter/highlighted_code_block.rb', line 28
def to_trix_content_attachment_partial_path
"action_text_syntax_highlighter/highlighted_code_blocks/editor"
end
|