/** * Copyright 2022 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import type { docs_v1 } from "@googleapis/docs"; import type { Element, Root } from "hast"; export interface HastOptions { /** * Header IDs are in the form `id="h.wn8l66qm9m7y"` when exported from the * Google Docs API. By default, header tag IDs are updated to match their text * content. See [github-slugger](https://www.npmjs.com/package/github-slugger) * for more information on how this is done. * * The default behavior can be disabled by setting this option to `false`. */ prettyHeaderIds?: boolean; /** * Styles are added to elements by default. This can be disabled by setting * this option to `false`. */ styles?: boolean; } export declare const DEFAULT_OPTIONS: { prettyHeaderIds: boolean; styles: boolean; }; export interface Context { options: HastOptions; doc: docs_v1.Schema$Document; } /** * Generate an HTML AST from a Google Docs document in JSON form. * * @param doc JSON representation of a Google Docs document. * @param options Options for the transformation. * @returns The HTML abstract syntax tree. * @see {@link https://developers.google.com/docs/api/reference/rest/v1/documents#Document | Google Docs API}. * @see {@link https://github.com/syntax-tree/hast | HTML abstract syntax tree (HAST)} */ export declare const toHast: (doc: docs_v1.Schema$Document, options?: HastOptions) => Root; /** * @deprecated Use {@link toHast} instead. */ export declare const hast: (doc: docs_v1.Schema$Document, options?: HastOptions) => Root; export declare const transform: (content: docs_v1.Schema$StructuralElement[], context: Context) => Element[];