Axonpack

Reference

Every export, so a caller that wants its own rendering can skip the components.

Everything the renderers use is exported. A caller that wants to render the parsed output itself can take it and leave the components alone.

Utilities

ExportSignatureNotes
detectLanguage(mimeType: string | undefined, body: string) => LanguageReads the content type, then sniffs the body
tokenize(code: string, language: Language) => Token[]Concatenating text returns the input unchanged
formatCode(code: string, language: Language) => stringReturns the input for a language it does not format
parseXml(source: string) => { root } | { error }Never throws
isExpandable(value: JsonValue) => booleanTrue for any object or array
hasChildren(value: JsonValue) => booleanFalse for empty ones, which is why they get no toggle
isPlainObject(value: JsonValue) => booleannull is not one
buildPreview(value) => stringThe summary a closed node shows
chunkArrayRange(length: number) => [number, number][]The bucket boundaries for a long array
collectExpandablePaths(path: string, value: JsonValue) => string[]Every path under a node, for expanding a subtree
collectMatchingPaths(path, value, matcher, rootLabel?) => Set<string>The branches a search opens, and nothing else
collectMatchingXmlPaths(root, path, matcher) => Set<string>The same for XmlTree
formatCopyValue(value: JsonValue) => stringJSON.stringify at two spaces
buildMatcher(query: SearchQuery) => Matcher | nullnull for an empty query. See Search
findMatchesranges over a stringWith clipMatches, splitByMatches and testMatch

Constants

ExportValueMeaning
SUPPORTED_LANGUAGES38Sorted
MAX_HIGHLIGHT_LENGTH50_000Above this, CodeHighlight renders unhighlighted
MAX_SEARCHABLE_LENGTH50_000The point past which a string is not searched
ARRAY_CHUNK_SIZE10Arrays longer than this are bucketed
DEFAULT_SEARCH_MODESobjectmatchCase, wholeWord and regex, all off

Types

From the root: JsonValue, Language, Token, TokenType, MenuItem, Matcher, MatchRange, SearchModes, SearchQuery, TextSegment, Primitives, JsonTreeProps, XmlTreeProps, CodeHighlightProps, XmlNode, XmlElement, XmlText, XmlCData, XmlParseResult.

From /themes: PrettyPrintTheme.

TokenType is one of keyword, string, comment, number, function, tag, attr-name, attr-value, property, selector, punctuation, plain.

On this page