@asciidoctor/core - v4.1.0
    Preparing search index...

    Class SemanticHtml5ConverterExperimental

    A built-in converter that generates HTML 5 output maximizing the use of semantic constructs — <section>, <aside>, <figure>, <nav>, <blockquote>, DPUB-ARIA roles — instead of the AsciiDoc.py-compatible markup produced by the default html5 backend.

    Registered for the semantic-html5 backend:

    const html = await Asciidoctor.convert(input, { backend: 'semantic-html5' })
    

    This converter is experimental. It is the fast-iteration testbed for the modern HTML output effort started upstream in Asciidoctor's feature/html-converter-next branch (see asciidoctor#242): shipping it here lets the semantic markup decisions be evaluated against real projects and real stylesheets, and the decisions that prove solid are meant to be ported back to the Ruby implementation. Consequences:

    • the emitted markup (elements, class names, structure) and the default stylesheet may change in any release, without being treated as breaking changes — pin an exact version if you depend on the output shape;
    • it is not a candidate to replace the default html5 backend, and the html5 backend's output is not affected in any way;
    • feedback on the element mapping is welcome on the upstream issue.

    The scenario fixtures under test/fixtures/semantic-html5-scenarios/ (shared with the upstream branch) are the source of truth for the emitted markup, and the per-node element mapping and design rationale are documented in devdocs/semantic-html5-converter.adoc.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    _decodeDataUri: (target: any) => any
    _voidSlash: string
    _xmlMode: boolean
    backend: any
    readSvgContents: (node: any, target: any) => Promise<any>

    Accessors

    • get logger(): LoggerLike
      Experimental

      The logger for this converter. The Logging mixin (logging.js) overrides this getter on the instance.

      Returns LoggerLike

    Methods

    • Experimental

      Convert using only content (no wrapping).

      Parameters

      • node: object

        the node whose content to return

      Returns Promise<string>

    • Experimental

      Convert a node by dispatching to a convert_<transform> method.

      Parameters

      • node: AbstractNode

        the AbstractNode to convert

      • Optionaltransform: string

        hint for which method to call (default: node.nodeName)

      • Optionalopts: object

        optional hints

      Returns unknown

      the result of the convert_<transform> handler; the actual type depends on the implementation

    • Experimental

      Parameters

      • node: any
      • Optionalopts: {}

      Returns Promise<string>

    • Experimental

      Alias for messageWithContext (used in extensions).

      Parameters

      • text: any
      • Optionalcontext: {}

      Returns {
          include_location?: any;
          source_location?: any;
          text: string;
          inspect(): string;
          toString(): string;
      }

    • Experimental

      Report whether this converter can handle the given transform.

      Parameters

      • transform: string

        the transform name

      Returns boolean

    • Experimental

      Build an auto-formatting log message that carries structured source_location (rather than baking it into the text), for use with this.logger.warn(...).

      Parameters

      • text: string
      • Optionalcontext: { include_location?: any; source_location?: any }

      Returns {
          include_location?: any;
          source_location?: any;
          text: string;
          inspect(): string;
          toString(): string;
      }

    • Experimental

      Register this converter class with the global registry.

      Parameters

      • ...backends: string[]

        backend names to register for

      Returns void