Skip to content

Commit

Permalink
feat(TextRun): add deemphasize property
Browse files Browse the repository at this point in the history
  • Loading branch information
jonz94 committed Nov 18, 2024
1 parent 3959150 commit 4f9cf02
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/parser/classes/misc/TextRun.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ export default class TextRun implements Run {
bold: boolean;
italics: boolean;
strikethrough: boolean;
deemphasize: boolean;
attachment;

constructor(data: RawNode) {
this.text = data.text;
this.bold = Boolean(data.bold);
this.italics = Boolean(data.italics);
this.strikethrough = Boolean(data.strikethrough);
this.deemphasize = Boolean(data.deemphasize);

if (Reflect.has(data, 'navigationEndpoint')) {
this.endpoint = new NavigationEndpoint(data.navigationEndpoint);
Expand All @@ -33,6 +35,7 @@ export default class TextRun implements Run {
if (this.bold) tags.push('b');
if (this.italics) tags.push('i');
if (this.strikethrough) tags.push('s');
if (this.deemphasize) tags.push('small');

const escaped_text = escape(this.text);
const styled_text = tags.map((tag) => `<${tag}>`).join('') + escaped_text + tags.map((tag) => `</${tag}>`).join('');
Expand Down

0 comments on commit 4f9cf02

Please sign in to comment.