Copyright | (c) Lorenzobattistela 2024 |
---|---|
License | MIT |
Maintainer | lorenzobattistela@gmail.com |
Stability | experimental |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Highlight
Description
This module provides functions to highlight and format text in terminal output, particularly useful for displaying code snippets with error highlighting.
Synopsis
- highlightError :: (Int, Int) -> (Int, Int) -> String -> String
- highlight :: (Int, Int) -> (Int, Int) -> String -> (String -> String) -> String -> String
- underline :: String -> String
- bold :: String -> String
- italic :: String -> String
- parenthesize :: String -> String
- strikethrough :: String -> String
- inverse :: String -> String
- getColor :: String -> String
Documentation
highlightError :: (Int, Int) -> (Int, Int) -> String -> String Source #
Highlight errors with red color and underline.
This function highlights text in the specified range with red color and underline.
sLine
,sCol
: Starting line and column position.eLine
,eCol
: Ending line and column position.file
: The text content to process.
Returns the highlighted text.
highlight :: (Int, Int) -> (Int, Int) -> String -> (String -> String) -> String -> String Source #
Highlight text in the given range.
This function highlights text within the specified range with the provided color and formatting function.
sPos
: Starting position as a tuple (line, column).ePos
: Ending position as a tuple (line, column).color
: The color code to apply for highlighting.format
: A function to format the highlighted text.file
: The text content to process.
Returns the highlighted text.
Applies underline formatting to text using ANSI escape codes.
Applies bold formatting to text using ANSI escape codes.
Applies italic formatting to text using ANSI escape codes.
Wraps text in parentheses.
Applies strikethrough formatting to text using ANSI escape codes.
Applies inverse (reverse video) formatting to text using ANSI escape codes.