Safe Haskell | None |
---|---|
Language | Haskell2010 |
Cheapskate.Highlight
Contents
- highlightDoc :: Doc -> Doc
- highlightDocWith :: (Text -> Text -> FormatOptions -> FormatOptions) -> Doc -> Doc
- highlightBlock :: Block -> Block
- highlightBlockWith :: (Text -> Text -> FormatOptions -> FormatOptions) -> Block -> Block
- data FormatOptions :: * = FormatOptions {
- numberLines :: Bool
- startNumber :: Int
- lineAnchors :: Bool
- titleAttributes :: Bool
- codeClasses :: [String]
- containerClasses :: [String]
- defaultFormatOpts :: FormatOptions
- styleToCss :: Style -> String
Highlighting
highlightDoc :: Doc -> Doc #
Highlight a document by replacing code blocks with raw HTML blocks.
By default, the rest of the attribute line (i.e. all words after the first word after ~~~
or ```
) get added as classes to the container block of the code.
highlightDocWith :: (Text -> Text -> FormatOptions -> FormatOptions) -> Doc -> Doc #
The function is given code block's language (i.e. the 1st word of the attribute line after ~~~
or ```
) and the rest of the attribute line.
If you don't want the classes to be derived from the attribute line, make the function set containerClasses
to []
.
highlightBlock :: Block -> Block #
highlightBlockWith :: (Text -> Text -> FormatOptions -> FormatOptions) -> Block -> Block #
Options
data FormatOptions :: * #
Constructors
FormatOptions | |
Fields
|
Instances
Styles
styleToCss :: Style -> String #