module Jrsl
Defined in:
jrsl.crConstant Summary
-
IMAGE_MAX_WIDTH =
119 -
Maximum width in terminal columns for rendered images
-
VERSION =
"0.4.0"
Class Method Summary
-
.calculate_image_max_height(md_rows : Int32, content_area_height : Int32, image_position : String, image_h_position : String) : Int32
Calculate available height for image based on markdown size and position
-
.center_x(screen_width : Int32, content_cols : Int32) : Int32
Column where a block of content_cols cells starts to be centered on a screen of screen_width columns
-
.effective_image_width(screen_width : Int32) : Int32
Effective maximum image width in cells: never wider than the screen
-
.fence_close_marker(line : String) : String | Nil
Return "```" or "~~~" when the line consists solely of fence marker characters, i.e.
-
.fence_open_marker(line : String) : String | Nil
Return "```" or "~~~" when the line opens a fenced code block: at least 3 marker characters, optionally indented, optionally followed by an info string (CommonMark allows no info string on closing fences)
-
.image_x_position(h_position : String, screen_width : Int32, img_cols : Int32) : Int32
Column where the image starts given its horizontal placement setting
- .load_image(path : String) : CrImage::Image | Nil
-
.normalize_for_figlet(text : String) : String
Normalize accented characters to ASCII for figlet
-
.parse_global_metadata(lines : Array(String)) : Tuple(PresentationMetadata, Int32)
Parse the optional global YAML metadata block at the top of the file.
-
.parse_slide_blocks(lines : Array(String), start_index : Int32) : Array(Slide)
Parse alternating blocks starting at start_index: slide metadata (YAML) followed by content (markdown), separated by "---" lines
- .parse_slides(content : String) : Tuple(Array(Slide), PresentationMetadata)
-
.query_cell_size : Tuple(Int16, Int16) | Nil
Returns {cell_height_px, cell_width_px}, or nil when the terminal does not report pixel dimensions (very common outside graphical terminals).
-
.read_slide_content(lines : Array(String), i : Int32) : Tuple(Array(String), Int32)
Read the slide content (markdown) lines starting at index i, until the next "---" delimiter or end of file.
-
.read_slide_metadata(lines : Array(String), i : Int32) : Tuple(SlideMetadata, Int32)
Read the slide metadata (YAML) lines starting at index i.
-
.render_image_kitty(path : String, max_width : Int32, max_height : Int32) : Tuple(String, Int32, Int32) | Nil
Render image using Kitty graphics protocol Returns the escape sequence string to display the image
-
.render_image_to_string(path : String, max_width : Int32, max_height : Int32) : Tuple(String, Int32, Int32) | Nil
Pre-render an image to a string before TUI initialization Uses half-block characters (▀) for 2x1 vertical resolution per cell Returns {rendered_string, line_count, width_in_chars} or nil if loading fails
-
.render_markdown_to_element(markdown : String, max_width : Int32) : MarkdownElement
Render markdown to a MarkdownElement with measured dimensions
-
.side_by_side_layout(h_position : String, screen_width : Int32, img_cols : Int32) : Tuple(Int32, Int32)
Side-by-side layout columns: Returns {image_x, md_x}
-
.stacked_layout(position : String, content_area_start : Int32, content_area_height : Int32, img_rows : Int32, md_rows : Int32) : Tuple(Int32, Int32, Int32)
Vertical positions for stacked layouts.
Class Method Detail
Calculate available height for image based on markdown size and position
Column where a block of content_cols cells starts to be centered on a screen of screen_width columns
Effective maximum image width in cells: never wider than the screen
Return "```" or "~~~" when the line consists solely of fence marker characters, i.e. it can close a fenced code block
Return "```" or "~~~" when the line opens a fenced code block: at least 3 marker characters, optionally indented, optionally followed by an info string (CommonMark allows no info string on closing fences)
Column where the image starts given its horizontal placement setting
Normalize accented characters to ASCII for figlet
Parse the optional global YAML metadata block at the top of the file. Returns the metadata and the line index where slide parsing starts.
Parse alternating blocks starting at start_index: slide metadata (YAML) followed by content (markdown), separated by "---" lines
Returns {cell_height_px, cell_width_px}, or nil when the terminal does not report pixel dimensions (very common outside graphical terminals).
Read the slide content (markdown) lines starting at index i, until the next "---" delimiter or end of file. "---" lines inside fenced code blocks do not count as delimiters. Returns the content lines and the index of the delimiter (or lines.size).
Read the slide metadata (YAML) lines starting at index i. Returns the parsed metadata and the index after any "---" delimiter.
Render image using Kitty graphics protocol Returns the escape sequence string to display the image
Pre-render an image to a string before TUI initialization Uses half-block characters (▀) for 2x1 vertical resolution per cell Returns {rendered_string, line_count, width_in_chars} or nil if loading fails
Render markdown to a MarkdownElement with measured dimensions
Side-by-side layout columns: Returns {image_x, md_x}
Vertical positions for stacked layouts. Returns {img_y, md_y, available_md_height}