Class HtmlTableFormatter

Formats a song into HTML. It uses TABLEs to align lyrics with chords, which makes the HTML for things like PDF conversion.

Hierarchy (View Summary)

Constructors

Accessors

Methods

Constructors

  • Instantiate the formatter. For all options see Formatter

    Parameters

    • Optionalconfiguration: Record<string, any> & Partial<
          {
              decapo: boolean;
              delegates: Partial<DelegatesConfiguration>;
              evaluate: boolean;
              expandChorusDirective: boolean;
              instrument: Partial<InstrumentConfiguration>;
              key: null | string | Key;
              metadata: Partial<MetadataConfiguration>;
              normalizeChords: boolean;
              user: Partial<UserConfigurationProperties>;
              useUnicodeModifiers: boolean;
          },
      > & { cssClasses?: Partial<HtmlTemplateCssClasses> } = {}

      options

      • cssClasses

        CSS classes to use in the HTML output. The default classes are defined in defaultCssClasses. You can override them by providing your own classes here:

      • cssClasses

        CSS classes to use in the HTML output. The default classes are defined in defaultCssClasses. You can override them by providing your own classes here:

      • OptionalcssClasses?: Partial<HtmlTemplateCssClasses>

        CSS classes to use in the HTML output. The default classes are defined in defaultCssClasses. You can override them by providing your own classes here:

    Returns HtmlTableFormatter

    {
    cssClasses: {
    annotation: 'my-annotation',
    chord: 'my-chord',
    chordSheet: 'my-chord-sheet',
    column: 'my-column',
    comment: 'my-comment',
    emptyLine: 'my-empty-line',
    label: 'my-label',
    labelWrapper: 'my-label-wrapper',
    line: 'my-line',
    literal: 'my-literal',
    literalContents: 'my-contents',
    lyrics: 'my-lyrics',
    paragraph: 'my-paragraph',
    row: 'my-row',
    subtitle: 'my-subtitle',
    title: 'my-title',
    }
    }

Accessors

  • get cssObject(): CSS
  • Basic CSS, in object style à la useStyles, to use with the HTML output For a CSS string see cssString

    Example:

    '.paragraph': {
      marginBottom: '1em'
    }
    

    Returns CSS

    the CSS object

Methods

  • Generates basic CSS, optionally scoped within the provided selector, to use with the HTML output

    For example, execute cssString('.chordSheetViewer') will result in CSS like:

    .chordSheetViewer .paragraph {
      margin-bottom: 1em;
    }
    

    Parameters

    • scope: string = ''

      the CSS scope to use, for example .chordSheetViewer

    Returns string

    the CSS string