add html output highlighting
This commit is contained in:
parent
040a1862c3
commit
c48b7be559
3 changed files with 57 additions and 22 deletions
|
@ -92,14 +92,32 @@ export %inline
|
|||
highlightSGR : HL -> Highlight
|
||||
highlightSGR h = MkHighlight (escapeSGR $ toSGR h) (escapeSGR [Reset])
|
||||
|
||||
export %inline
|
||||
toClass : HL -> String
|
||||
toClass Delim = "dl"
|
||||
toClass Free = "fr"
|
||||
toClass TVar = "tv"
|
||||
toClass TVarErr = "tv err"
|
||||
toClass Dim = "dc"
|
||||
toClass DVar = "dv"
|
||||
toClass DVarErr = "dv err"
|
||||
toClass Qty = "qt"
|
||||
toClass Universe = "un"
|
||||
toClass Syntax = "sy"
|
||||
toClass Constant = "co"
|
||||
|
||||
export %inline
|
||||
highlightHtml : HL -> Highlight
|
||||
highlightHtml h = MkHighlight #"<span class="\#{toClass h}">"# "</span>"
|
||||
|
||||
|
||||
export %inline
|
||||
runPrettyHL : (HL -> Highlight) -> Eff Pretty a -> a
|
||||
runPrettyHL f = runPrettyWith Outer Unicode f 2
|
||||
|
||||
export %inline
|
||||
runPretty : Eff Pretty a -> a
|
||||
runPretty = runPrettyWith Outer Unicode noHighlight 2
|
||||
|
||||
export %inline
|
||||
runPrettyColor : Eff Pretty a -> a
|
||||
runPrettyColor = runPrettyWith Outer Unicode highlightSGR 2
|
||||
runPretty = runPrettyHL noHighlight
|
||||
|
||||
|
||||
export %inline
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue