|
| 1 | +export type PostHTMLExpressions = { |
| 2 | + /** |
| 3 | + Define the starting and ending delimiters used for expressions. |
| 4 | +
|
| 5 | + @default ['{{', '}}'] |
| 6 | + */ |
| 7 | + delimiters?: string[]; |
| 8 | + |
| 9 | + /** |
| 10 | + Define the starting and ending delimiters used for unescaped expressions. |
| 11 | +
|
| 12 | + @default ['{{{', '}}}'] |
| 13 | + */ |
| 14 | + unescapeDelimiters?: string[]; |
| 15 | + |
| 16 | + /** |
| 17 | + Object containing data that will be available under the `page` object. |
| 18 | +
|
| 19 | + @default {} |
| 20 | + */ |
| 21 | + locals?: Record<string, unknown>; |
| 22 | + |
| 23 | + /** |
| 24 | + Attribute name for `<script>` tags that contain locals. |
| 25 | +
|
| 26 | + @default 'locals' |
| 27 | + */ |
| 28 | + localsAttr?: string; |
| 29 | + |
| 30 | + /** |
| 31 | + Whether to remove `<script>` tags that contain locals. |
| 32 | +
|
| 33 | + @default false |
| 34 | + */ |
| 35 | + removeScriptLocals?: boolean; |
| 36 | + |
| 37 | + /** |
| 38 | + Tag names to be used for if/else statements. |
| 39 | +
|
| 40 | + @default ['if', 'elseif', 'else'] |
| 41 | + */ |
| 42 | + conditionalTags?: string[]; |
| 43 | + |
| 44 | + /** |
| 45 | + Tag names to be used for switch statements. |
| 46 | +
|
| 47 | + @default ['switch', 'case', 'default'] |
| 48 | + */ |
| 49 | + switchTags?: string[]; |
| 50 | + |
| 51 | + /** |
| 52 | + Tag names to be used for loops. |
| 53 | +
|
| 54 | + @default ['each', 'for'] |
| 55 | + */ |
| 56 | + loopTags?: string[]; |
| 57 | + |
| 58 | + /** |
| 59 | + Tag names to be used for scopes. |
| 60 | +
|
| 61 | + @default ['scope'] |
| 62 | + */ |
| 63 | + scopeTags?: string[]; |
| 64 | + |
| 65 | + /** |
| 66 | + Name of tag inside of which expression parsing is disabled. |
| 67 | +
|
| 68 | + @default 'raw' |
| 69 | + */ |
| 70 | + ignoredTag?: string; |
| 71 | + |
| 72 | + /** |
| 73 | + Enabling strict mode will throw an error if an expression cannot be evaluated. |
| 74 | +
|
| 75 | + @default false |
| 76 | + */ |
| 77 | + strictMode?: boolean; |
| 78 | + |
| 79 | + /** |
| 80 | + What to render when referencing a value that is not defined in `locals`. |
| 81 | +
|
| 82 | + By default, the string 'undefined' will be output. |
| 83 | +
|
| 84 | + @default undefined |
| 85 | +
|
| 86 | + @example |
| 87 | +
|
| 88 | + ``` |
| 89 | + // Output empty string if value is not defined |
| 90 | + missingLocal: '' |
| 91 | +
|
| 92 | + // Output original reference if value is not defined |
| 93 | + missingLocal: '{local}' |
| 94 | +
|
| 95 | + // Output custom string if value is not defined |
| 96 | + missingLocal: 'ERR_NO_VALUE: {local}' |
| 97 | + ``` |
| 98 | + */ |
| 99 | + missingLocal?: string; |
| 100 | +} |
0 commit comments