europa-core
Version:
Europa core engine for converting HTML into valid Markdown
39 lines (38 loc) • 1.33 kB
TypeScript
import { Dom } from "./dom/Dom";
import { DomRoot } from "./dom/DomRoot";
/**
* Defines the environment in which the {@link EuropaCore} implementation exists.
*/
export interface Environment<N, E extends N> {
/**
* Returns the default base URI to be used when resolving absolute URLs.
*
* @return The default base URI.
*/
getDefaultBaseUri(): string;
/**
* Returns the default end of line character to be inserted into generated Markdown.
*
* @return The default end of line character.
*/
getDefaultEndOfLineCharacter(): string;
/**
* Returns the DOM wrapper to be used in this {@link Environment}.
*
* This method should always return the same {@link Dom} instance when called multiple times.
*
* @return The {@link Dom}.
*/
getDom(): Dom<N, E, DomRoot>;
/**
* Returns the specified `url` relative to the `baseUri` provided in a manner similar to that of a web browser
* resolving an anchor element.
*
* A relative URL may still be returned but only if `baseUri` itself is relative.
*
* @param baseUri - The base URI to use if `url` is a relative URL.
* @param url - The target URL to resolve.
* @return The resolved `url`.
*/
resolveUrl(baseUri: string, url: string): string;
}