Export Code Type:
Export Code Scope of Action:
Export Code First Added:
Export Code in Current Baseline:
Export Code Last Altered:
Export Mark-up [other codes of this type]
item [codes with similar scope]
v1.0.0
Baseline
As at baseline
^indent( [data][, N] )^
Exports the data as a string, repeated once for each ancestor of the currently exported note (i.e. the equivalent of $OutlineDepth-1 times), or N times if the latter is specified.
^indent^
Exports a tab character for each ancestor of the currently exported note except root level, i.e. tab is the default indent if no data argument is supplied.
data. The number of times data or a tab is emitted is ($OutlineDepth-1); for aliases this is the alias' value and not that of the original.
By original intent, this code applied to the (HTML) source of the exported note, but depending on string used for data, this might affect the visual render. Whereas the default \t
only affects the HTML, a data value of
would insert two non-breaking spaced per tab that would render in the output.
N. The default can be superseded by supplying an optional second argument N. N is evaluated so may either be a number or an expression, e.g. $OutlineDepth+3
. This kind of thing is useful if trying to correctly indent source code and when the export 'base' is at a level other than the root of the TBX.
If the N argument is used, the data argument must also be supplied. To explicitly specify a tab, as in the normal default, use "\t", e.g. ^indent("\t",6)^
.
For web use, tabs are ignored for white space so consider using one or more " " space HTML entities as the data value.
Examples
In the source TBX document this note is at Outline Depth 6, so ^indent(data)^
will emit the data value 5 times. Thus, if we use a hyphen as the indent's data value, you see:
-----Text indented with ^indent(-)^
.
In the next example the on-screen text should be visibly indented three (non-proportional) spaces:
Text indented with ^indent( )^
.
Note how the visual HTML output of the next two examples is not visibly indented as tabs are not interpreted as white space mark-up in HTML, but are present in the HTML source:
Text indented with ^indent^
(i.e. tab).
Text indented with tabs to outline level plus 4 (i.e. ^value(eval($OutlineDepth+4))^ tabs, thus 10 tabs)
Thus, if you view the HTML source for the page, you will see first of the two examples immediately above has output 6
tabs. For the example following it, you will see 10
tabs have been output; depending on the program viewing the source you may be able to 'see' these as tabs by moving the cursor through the source code with the arrow keys: you will see it jump from tab to tab.
Root level notes are not indented.
See also—notes linking to here: