Class: KBuilder::Commands::CodeSyntaxHighlighterCommand
- Inherits:
-
BaseCommand
- Object
- BaseCommand
- KBuilder::Commands::CodeSyntaxHighlighterCommand
- Defined in:
- lib/k_builder/commands/code_syntax_highlighter_command.rb
Overview
Run CodeSyntaxHighlighter against source code and produce a styled HTML representation
Alternatives to Highlighter-js could be carbon-now and ray.so
Instance Attribute Summary collapse
-
#formatted_code ⇒ Object
readonly
Returns the value of attribute formatted_code.
-
#source_code ⇒ Object
readonly
Returns the value of attribute source_code.
Attributes inherited from BaseCommand
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(source_code, **opts) ⇒ CodeSyntaxHighlighterCommand
constructor
A new instance of CodeSyntaxHighlighterCommand.
Methods inherited from BaseCommand
Constructor Details
#initialize(source_code, **opts) ⇒ CodeSyntaxHighlighterCommand
Returns a new instance of CodeSyntaxHighlighterCommand.
12 13 14 15 16 |
# File 'lib/k_builder/commands/code_syntax_highlighter_command.rb', line 12 def initialize(source_code, **opts) super(**opts) self.source_code = source_code end |
Instance Attribute Details
#formatted_code ⇒ Object (readonly)
Returns the value of attribute formatted_code.
10 11 12 |
# File 'lib/k_builder/commands/code_syntax_highlighter_command.rb', line 10 def formatted_code @formatted_code end |
#source_code ⇒ Object
Returns the value of attribute source_code.
9 10 11 |
# File 'lib/k_builder/commands/code_syntax_highlighter_command.rb', line 9 def source_code @source_code end |
Instance Method Details
#execute ⇒ Object
18 19 20 21 22 |
# File 'lib/k_builder/commands/code_syntax_highlighter_command.rb', line 18 def execute return unless valid? run end |