Class: Inkpen::Extensions::Preformatted
- Defined in:
- lib/inkpen/extensions/preformatted.rb
Overview
Preformatted text extension for TipTap.
Plain text block that preserves whitespace exactly as typed. Perfect for ASCII art, ASCII tables, diagrams, and any content that requires precise character alignment.
Unlike CodeBlock, this has NO syntax highlighting - just pure monospace text with preserved whitespace.
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#label_text ⇒ String
Custom label text.
-
#name ⇒ Symbol
The unique name of this extension.
-
#show_label? ⇒ Boolean
Whether to show a label/badge.
-
#show_line_numbers? ⇒ Boolean
Whether to show line numbers.
-
#tab_size ⇒ Integer
Tab size in spaces.
-
#to_config ⇒ Hash
Convert to configuration hash for JavaScript.
-
#wrap_lines? ⇒ Boolean
Whether to wrap long lines.
Methods inherited from Base
#enabled?, #initialize, #to_h, #to_json
Constructor Details
This class inherits a constructor from Inkpen::Extensions::Base
Instance Method Details
#label_text ⇒ String
Custom label text.
79 80 81 |
# File 'lib/inkpen/extensions/preformatted.rb', line 79 def label_text .fetch(:label_text, "Plain Text") end |
#name ⇒ Symbol
The unique name of this extension.
34 35 36 |
# File 'lib/inkpen/extensions/preformatted.rb', line 34 def name :preformatted end |
#show_label? ⇒ Boolean
Whether to show a label/badge.
70 71 72 |
# File 'lib/inkpen/extensions/preformatted.rb', line 70 def show_label? .fetch(:show_label, true) end |
#show_line_numbers? ⇒ Boolean
Whether to show line numbers.
43 44 45 |
# File 'lib/inkpen/extensions/preformatted.rb', line 43 def show_line_numbers? .fetch(:show_line_numbers, false) end |
#tab_size ⇒ Integer
Tab size in spaces.
61 62 63 |
# File 'lib/inkpen/extensions/preformatted.rb', line 61 def tab_size .fetch(:tab_size, 4) end |
#to_config ⇒ Hash
Convert to configuration hash for JavaScript.
88 89 90 91 92 93 94 95 96 |
# File 'lib/inkpen/extensions/preformatted.rb', line 88 def to_config { showLineNumbers: show_line_numbers?, wrapLines: wrap_lines?, tabSize: tab_size, showLabel: show_label?, labelText: label_text } end |
#wrap_lines? ⇒ Boolean
Whether to wrap long lines.
52 53 54 |
# File 'lib/inkpen/extensions/preformatted.rb', line 52 def wrap_lines? .fetch(:wrap_lines, false) end |