Skip to content

Commit

Permalink
doc(fmt): add exampls and doc for indent_string option
Browse files Browse the repository at this point in the history
  • Loading branch information
xudyang1 committed Nov 28, 2024
1 parent 71665e7 commit df72ea9
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions DOC.md
Original file line number Diff line number Diff line change
Expand Up @@ -1526,6 +1526,23 @@ ls.add_snippets("all", {
}, {
repeat_duplicates = true
}))
s("example5", fmt([[
line1: no indent
line3: 2 space -> 1 indent ('\t')
line4: 4 space -> 2 indent ('\t\t')
]], {}, {
indent_string = " "
}))
-- NOTE: [[\t]] means '\\t'
s("example6", fmt([[
line1: no indent
\tline3: '\\t' -> 1 indent ('\t')
\t\tline4: '\\t\\t' -> 2 indent ('\t\t')
]], {}, {
indent_string = [[\t]]
}))
})
```

Expand Down Expand Up @@ -1560,6 +1577,9 @@ any way, correspond to the jump-index of the nodes!
when passing multiline strings via `[[]]` (default true).
* `dedent`: remove indent common to all lines in `format`. Again, makes
passing multiline-strings a bit nicer (default true).
* `indent_string`: convert `indent_string` at beginning of each line to unit
indent ('\t'). This is applied after `dedent`. Useful when using
multiline string in `fmt`. (default empty string, disabled)
* `repeat_duplicates`: repeat nodes when a key is reused instead of copying
the node if it has a jump-index, refer to [Basics-Jump-Index](#jump-index) to
know which nodes have a jump-index (default false).
Expand Down

0 comments on commit df72ea9

Please sign in to comment.