pablohirafuji/elm-syntax-highlight/1.0.0

NOTE: this package is not compatible with Elm 0.19.1

SyntaxHighlight.Line

A parsed highlighted line.

type alias Line =
{ fragments : List Fragment
, highlight : Maybe Highlight
}

A line.

type alias Fragment =
{ text : String
, color : Color
, isEmphasis : Bool
, isStrong : Bool
}

A fragment.

type Color
= Default
| Color1
| Color2
| Color3
| Color4
| Color5
| Color6
| Color7

Possible colors.

The common uses of the color are the following:

  • Default: Default color
  • Color1: Comment
  • Color2: Literal string, attribute value
  • Color3: Keyword, tag, operator symbol (=+-*/...)
  • Color4: Keyword, type signature, group symbol ({}(),)
  • Color5: Function, attribute name
  • Color6: Literal keyword
  • Color7: Argument, parameter
= Normal
| Add
| Delete

Highlight type.

Helpers

highlightLines : Maybe Highlight -> Int -> Int -> List Line -> List Line

Highlight lines given a highlight type, start and end index. If no highlight type is given (Nothing), it will remove any highlight from that lines. Negative indexes are taken starting from the end of the list.