File tree Expand file tree Collapse file tree 2 files changed +13
-6
lines changed Expand file tree Collapse file tree 2 files changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ Documentation
5353
5454#### render
5555
56- ` render (doc[, colwidth[, ansi ]]) `
56+ ` render (doc[, colwidth[, style ]]) `
5757
5858Render the ` Doc ` using the given column width.
5959
@@ -65,9 +65,9 @@ Parameters:
6565` colwidth `
6666: Maximum number of characters per line
6767
68- ` ansi `
69- : Whether to generate plain or ANSI terminal output. Defaults to
70- ` false ` . (boolean )
68+ ` style `
69+ : Whether to generate ' plain' or ' ANSI' terminal output. Must be
70+ either ` 'plain' ` or ` 'ansi' ` . Defaults to ` 'plain' ` . (string )
7171
7272### Doc construction
7373
Original file line number Diff line number Diff line change @@ -268,15 +268,22 @@ render = defun "render"
268268 " Maximum number of characters per line.\n " <>
269269 " A value of `nil`, the default, means that the text " <>
270270 " is not reflown." )
271- <#> opt (boolParam " ansi " $
271+ <#> opt (parameter peekRenderStyle " string " " style " $
272272 " Whether to generate plain text or ANSI terminal output.\n " <>
273- " Defaults to `false`." )
273+ " Must be either `'plain'` or `'ansi'`.\n " <>
274+ " Defaults to `'plain'`." )
274275 =#> functionResult pushText " string" " rendered doc"
275276 #? T. unlines
276277 [ " Render a [[Doc]]. The text is reflowed on breakable spaces to"
277278 , " match the given line length. Text is not reflowed if the line"
278279 , " line length parameter is omitted or nil."
279280 ]
281+ where
282+ peekRenderStyle idx = peekByteString idx >>= \ case
283+ " ansi" -> pure True
284+ " ANSI" -> pure True
285+ " plain" -> pure False
286+ style -> failPeek $ " Unknown rendering style: " <> style
280287
281288--
282289-- Querying
You can’t perform that action at this time.
0 commit comments