Skip to content

Commit

Permalink
document truncate
Browse files Browse the repository at this point in the history
  • Loading branch information
pront committed Sep 26, 2023
1 parent 7a5f625 commit dadc3a2
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions website/cue/reference/remap/functions/truncate.cue
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,18 @@ remap: functions: truncate: {
{
name: "ellipsis"
description: """
An ellipsis (`...`) is appended if this is set to `true` _and_ the `value` string ends up being
truncated because it's exceeded the `limit`.
This argument is depracted. An ellipsis (`...`) is appended if this is set to `true` _and_ the `value` string
ends up being truncated because it's exceeded the `limit`.
"""
de
required: true
type: ["boolean"]
},
{
name: "suffix"
description: """
A custom suffix (`...`) will be appended to truncated strings.
This is ignored if "ellipsis" is set to true for backwards compatibility.
"""
required: true
type: ["boolean"]
Expand All @@ -46,5 +56,12 @@ remap: functions: truncate: {
"""#
return: "A rather lo..."
},
{
title: "Truncate a string"
source: #"""
truncate("A rather long sentence.", limit: 11, suffix: "[TRUNCATED]")
"""#
return: "A rather lo[TRUNCATED]"
},
]
}

0 comments on commit dadc3a2

Please sign in to comment.