skipLatexWhitespace
How to read this API
These are TypeScript APIs compiled into SnapTeX; a .tex project cannot load them at runtime.
function name(...)is a helper that your rule imports and calls.apply(...),render(...),extract(...), andcollect(...)are callbacks that your rule implements and SnapTeX calls.renderer.name(...),context.name(...),input.name(...), anddeps.name(...)are methods SnapTeX supplies to callbacks; do not import or construct them.service.name(...)is an instance method called after your host or test constructsPreviewUpdateService.
Register extension declarations through SNAP_TEX_RULES in src/rules.ts. See Source API Scope for imports, value ownership, output safety, rebuilds, and testing.
Advances an index across LaTeX whitespace and complete % line comments. It is a source-reader primitive, not a document cleanup pass.
Signature
ts
function skipLatexWhitespace(text: string, index: number): numberParameters
| Parameter | Description |
|---|---|
text | Source being read |
index | Starting offset |
Returns
The first offset that is neither whitespace nor a line comment, or text.length when no token remains.
Call relationships
- Called by:
readLatexGroupandreadLatexCommandAt. - Does not: alter source or validate the token at the returned offset.
ts
const tokenStart = skipLatexWhitespace(source, commandEnd);Escaped percent signs are not a supported starting comment token for this reader because it only enters comment skipping when the current character itself is %.