Spaces:
Sleeping
Sleeping
File size: 2,114 Bytes
31248b9 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
import { DocNodeKind, DocNode } from './DocNode';
import { DocExcerpt, ExcerptKind } from './DocExcerpt';
/**
* The style of escaping to be used with DocEscapedText.
*/
export var EscapeStyle;
(function (EscapeStyle) {
/**
* Use a backslash symbol to escape the character.
*/
EscapeStyle[EscapeStyle["CommonMarkBackslash"] = 0] = "CommonMarkBackslash";
})(EscapeStyle || (EscapeStyle = {}));
/**
* Represents a text character that should be escaped as a TSDoc symbol.
* @remarks
* Note that renders will normally apply appropriate escaping when rendering
* DocPlainText in a format such as HTML or TSDoc. The DocEscapedText node
* forces a specific escaping that may not be the default.
*/
export class DocEscapedText extends DocNode {
/**
* Don't call this directly. Instead use {@link TSDocParser}
* @internal
*/
constructor(parameters) {
super(parameters);
this._escapeStyle = parameters.escapeStyle;
this._encodedTextExcerpt = new DocExcerpt({
configuration: this.configuration,
excerptKind: ExcerptKind.EscapedText,
content: parameters.encodedTextExcerpt
});
this._decodedText = parameters.decodedText;
}
/** @override */
get kind() {
return DocNodeKind.EscapedText;
}
/**
* The style of escaping to be performed.
*/
get escapeStyle() {
return this._escapeStyle;
}
/**
* The text sequence including escapes.
*/
get encodedText() {
if (this._encodedText === undefined) {
this._encodedText = this._encodedTextExcerpt.content.toString();
}
return this._encodedText;
}
/**
* The text without escaping.
*/
get decodedText() {
return this._decodedText;
}
/** @override */
onGetChildNodes() {
return [this._encodedTextExcerpt];
}
}
//# sourceMappingURL=DocEscapedText.js.map |