Home > @jsamr/counter-style > CounterStyleRenderer
An object to render counters.
Signature:
export interface CounterStyleRenderer
Method | Description |
---|---|
maxCounterLenInRange(min, max) | Get the maximum counter representation length given an index range. If a fallback is defined, it will be used for values outside the range boundaries of this renderer. |
maxMarkerLenInRange(min, max) | Get the maximum marker string length given an index range. If a fallback is defined, it will be used for values outside the range boundaries of this renderer. |
renderCounter(index) | Render an index into its counter representation, equivalent to CSS counter function. See CSS Counter Styles Level 3, Counter Styles. |
renderMarker(index) | Render an index into its corresponding marker string. See CSS Lists Level 3, Text-based Markers. |
renderPrefix() | Render this renderer's prefix. |
renderSuffix() | Render this renderer's suffix. |
withFallback(fallback) | Create a new renderer with a fallback used when the index is out of bounds.See CSS Counter Styles Level 3, Defining fallback: the fallback descriptor. |
withMaxLengthComputer(computer) | Create a new renderer with a (hopefuly) cost-effective max codepoint length computer. |
withNegative(prefix, suffix) | Create a new renderer which will render negative values by prefixing and suffixing the provided characters to the renderer function.See CSS Counter Styles Level 3, Formatting negative values: the negative descriptor. |
withPadLeft(length, pad) | Create a new renderer which adds padding to the left.See CSS Counter Styles Level 3, Zero-Padding and Constant-Width Representations: the pad descriptor. |
withPadRight(length, pad) | Create a new renderer which adds padding to the right.See CSS Counter Styles Level 3, Zero-Padding and Constant-Width Representations: the pad descriptor. |
withPrefix(prefix) | Create a new renderer which replaces or removes this renderer prefix.See CSS Counter Styles Level 3, Symbols before the marker: the prefix descriptor. |
withRange(min, max, fallback) | Create a new renderer with a constrained range. When the index is out of bounds, the counter representation is rendered with the provided fallback, or the default fallback if none was provided.See CSS Counter Styles Level 3, Limiting the counter scope: the range descriptor. |
withRtl(options) | Create a new renderer which renders Right-to-left. |
withSuffix(suffix) | Create a new renderer which replaces or removes this renderer suffix.See CSS Counter Styles Level 3, Symbols after the marker: the suffix descriptor. |