github.com/Ilhicas/nomad@v1.0.4-0.20210304152020-e86851182bc3/website/content/docs/job-specification/hcl2/functions/string/indent.mdx (about)

     1  ---
     2  layout: docs
     3  page_title: indent - Functions - Configuration Language
     4  sidebar_title: indent
     5  description: |-
     6    The indent function adds a number of spaces to the beginnings of all but the
     7    first line of a given multi-line string.
     8  ---
     9  
    10  # `indent` Function
    11  
    12  `indent` adds a given number of spaces to the beginnings of all but the first
    13  line in a given multi-line string.
    14  
    15  ```hcl
    16  indent(num_spaces, string)
    17  ```
    18  
    19  ## Examples
    20  
    21  This function is useful for inserting a multi-line string into an
    22  already-indented context in another string:
    23  
    24  ```shell-session
    25  > "  items: %{indent(2, "[\n  foo,\n  bar,\n]\n")}"
    26    items: [
    27      foo,
    28      bar,
    29    ]
    30  ```
    31  
    32  The first line of the string is not indented so that, as above, it can be
    33  placed after an introduction sequence that has already begun the line.