@yamlresume/core
    Preparing search index...

    Class DocxRendererAbstract

    Abstract base DOCX renderer for generating Word documents from resume data.

    This class provides common utilities and helper methods for DOCX rendering. Specific templates should extend this class and implement the abstract section rendering methods.

    Unlike other renderers that extend Renderer and return strings, this renderer produces DOCX binary output via the docx library. The abstract methods are implemented to return Paragraph arrays for compatibility, but the main output is via render() which returns a Promise.

    Hierarchy (View Summary)

    Index
    • Constructor for the DocxRenderer class.

      Parameters

      • resume: Resume

        The resume object

      • layoutIndex: number

        The index of the selected layout to use.

      • summaryParser: Parser = ...

        The summary parser used to parse summary field in various sections.

      Returns DocxRenderer

    codeGenerator: DocxCodeGenerator

    Code generator for generating DOCX paragraphs from AST nodes.

    layoutIndex: number
    resume: Resume
    summaryParser: Parser

    Markdown parser instance used for parsing summary fields.

    • Create a text paragraph with a bold label prefix and normal value suffix.

      Parameters

      • label: string

        The bold label text (e.g., "Keywords: ")

      • value: string

        The normal value text

      Returns Paragraph

      A DOCX paragraph with mixed bold/normal text

    • Create a detail line paragraph (italicized).

      Parameters

      • text: string

        The text content

      Returns Paragraph

      A DOCX paragraph with italic styling

    • Convert a markdown string to DOCX paragraphs.

      This method parses markdown content and converts it to appropriate DOCX paragraph elements, supporting:

      • Plain text paragraphs
      • Bold and italic formatting
      • Links (as external hyperlinks)
      • Bullet lists (unordered lists)
      • Ordered lists

      Parameters

      • markdown: string

        The markdown string to convert

      Returns Paragraph[]

      Array of DOCX paragraphs

    • Create a section heading paragraph with horizontal rule.

      Parameters

      • text: string

        The heading text

      Returns Paragraph

      A DOCX paragraph with heading styling

    • Create a subsection heading paragraph.

      Parameters

      • text: string

        The heading text

      Returns Paragraph

      A DOCX paragraph with subheading styling

    • Create a two-column layout paragraph with optional right-aligned content.

      Uses a right-aligned tab stop to push the right content to the margin. Both left and right content can contain TextRun or ExternalHyperlink nodes.

      Parameters

      • leftContent: (TextRun | ExternalHyperlink)[]

        Array of TextRun or ExternalHyperlink for the left column

      • OptionalrightContent: (TextRun | ExternalHyperlink)[]

        Optional array of TextRun or ExternalHyperlink for the right column

      • Optionalspacing: { after?: number; line?: number }

        Optional spacing configuration for the paragraph

      • OptionaltabSize: number

      Returns Paragraph

      A DOCX paragraph with two-column layout

    • Get the line spacing name from typography settings.

      Returns "tight" | "snug" | "normal" | "relaxed" | "loose"

      Line spacing option name

    • Get page margins from layout settings.

      Returns { bottom: number; left: number; right: number; top: number }

      Page margins in twips

    • Get the paper size dimensions in twips for the document.

      DOCX page dimensions are specified in twips (1/20 of a point).

      Returns { height: number; width: number }

      Paper size dimensions

    • Get scaled font size based on base font size.

      Parameters

      • scale: number

        Scale factor (e.g., 2 for title = 2x base size)

      Returns number

      Scaled font size in half-points

    • Join multiple rendered sections into a single output.

      Parameters

      • sections: Paragraph[][]

        The sections to join

      Returns Paragraph[]

      The joined sections

    • Render the resume as a DOCX Uint8Array.

      Returns Promise<Uint8Array<ArrayBufferLike>>

      A promise that resolves to the DOCX data

    • Create paragraphs for the certificates section.

      Returns Paragraph[]

      Array of DOCX paragraphs for certificates

    • Create paragraphs for the education section.

      Returns Paragraph[]

      Array of DOCX paragraphs for education

    • Create paragraphs for the interests section.

      Returns Paragraph[]

      Array of DOCX paragraphs for interests

    • Create paragraphs for the languages section.

      Returns Paragraph[]

      Array of DOCX paragraphs for languages

    • Create paragraphs for the location section.

      Returns Paragraph[]

      Array of DOCX paragraphs for location

    • Render sections in the specified order.

      Returns Paragraph[]

      The rendered sections in the specified order

    • Render the preamble of the resume.

      Returns Paragraph[]

      Empty array as DOCX handled within Document directly

    • Create paragraphs for the profiles section.

      Returns Paragraph[]

      Array of DOCX paragraphs for profiles

    • Create paragraphs for the projects section.

      Returns Paragraph[]

      Array of DOCX paragraphs for projects

    • Create paragraphs for the publications section.

      Returns Paragraph[]

      Array of DOCX paragraphs for publications

    • Create paragraphs for the references section.

      Returns Paragraph[]

      Array of DOCX paragraphs for references

    • Create paragraphs for the summary section.

      Returns Paragraph[]

      Array of DOCX paragraphs for summary

    • Create paragraphs for the volunteer section.

      Returns Paragraph[]

      Array of DOCX paragraphs for volunteer