CoolFace
Datasetpublic

basant307/AI_Governance_Project

sourceHugging Faceapache-2.0updated 2mo agoView on Hugging Face
0likes48downloads
index.d.ts155 linesDownload Raw Back to lib
1/**2 * Component to render markdown.3 *4 * This is a synchronous component.5 * When using async plugins,6 * see {@linkcode MarkdownAsync} or {@linkcode MarkdownHooks}.7 *8 * @param {Readonly<Options>} options9 *   Props.10 * @returns {ReactElement}11 *   React element.12 */13export function Markdown(options: Readonly<Options>): ReactElement;14/**15 * Component to render markdown with support for async plugins16 * through async/await.17 *18 * Components returning promises are supported on the server.19 * For async support on the client,20 * see {@linkcode MarkdownHooks}.21 *22 * @param {Readonly<Options>} options23 *   Props.24 * @returns {Promise<ReactElement>}25 *   Promise to a React element.26 */27export function MarkdownAsync(options: Readonly<Options>): Promise<ReactElement>;28/**29 * Component to render markdown with support for async plugins through hooks.30 *31 * This uses `useEffect` and `useState` hooks.32 * Hooks run on the client and do not immediately render something.33 * For async support on the server,34 * see {@linkcode MarkdownAsync}.35 *36 * @param {Readonly<Options>} options37 *   Props.38 * @returns {ReactElement}39 *   React element.40 */41export function MarkdownHooks(options: Readonly<Options>): ReactElement;42/**43 * Make a URL safe.44 *45 * @satisfies {UrlTransform}46 * @param {string} value47 *   URL.48 * @returns {string}49 *   Safe URL.50 */51export function defaultUrlTransform(value: string): string;52/**53 * Filter elements.54 */55export type AllowElement = (element: Readonly<Element>, index: number, parent: Readonly<Parents> | undefined) => boolean | null | undefined;56/**57 * Extra fields we pass.58 */59export type ExtraProps = {60    /**61     * passed when `passNode` is on.62     */63    node?: Element | undefined;64};65/**66 * Map tag names to components.67 */68export type Components = { [Key in Extract<ElementType, string>]?: ElementType<ComponentProps<Key> & ExtraProps>; };69/**70 * Deprecation.71 */72export type Deprecation = {73    /**74     *   Old field.75     */76    from: string;77    /**78     *   ID in readme.79     */80    id: string;81    /**82     * New field.83     */84    to?: keyof Options;85};86/**87 * Configuration.88 */89export type Options = {90    /**91     * Filter elements (optional);92     * `allowedElements` / `disallowedElements` is used first.93     */94    allowElement?: AllowElement | null | undefined;95    /**96     * Tag names to allow (default: all tag names);97     * cannot combine w/ `disallowedElements`.98     */99    allowedElements?: ReadonlyArray<string> | null | undefined;100    /**101     * Markdown.102     */103    children?: string | null | undefined;104    /**105     * Wrap in a `div` with this class name.106     */107    className?: string | null | undefined;108    /**109     * Map tag names to components.110     */111    components?: Components | null | undefined;112    /**113     * Tag names to disallow (default: `[]`);114     * cannot combine w/ `allowedElements`.115     */116    disallowedElements?: ReadonlyArray<string> | null | undefined;117    /**118     * List of rehype plugins to use.119     */120    rehypePlugins?: PluggableList | null | undefined;121    /**122     * List of remark plugins to use.123     */124    remarkPlugins?: PluggableList | null | undefined;125    /**126     * Options to pass through to `remark-rehype`.127     */128    remarkRehypeOptions?: Readonly<RemarkRehypeOptions> | null | undefined;129    /**130     * Ignore HTML in markdown completely (default: `false`).131     */132    skipHtml?: boolean | null | undefined;133    /**134     * Extract (unwrap) what’s in disallowed elements (default: `false`);135     * normally when say `strong` is not allowed, it and it’s children are dropped,136     * with `unwrapDisallowed` the element itself is replaced by its children.137     */138    unwrapDisallowed?: boolean | null | undefined;139    /**140     * Change URLs (default: `defaultUrlTransform`)141     */142    urlTransform?: UrlTransform | null | undefined;143};144/**145 * Transform all URLs.146 */147export type UrlTransform = (url: string, key: string, node: Readonly<Element>) => string | null | undefined;148import type { ReactElement } from 'react';149import type { Element } from 'hast';150import type { Parents } from 'hast';151import type { ElementType } from 'react';152import type { ComponentProps } from 'react';153import type { PluggableList } from 'unified';154import type { Options as RemarkRehypeOptions } from 'remark-rehype';155//# sourceMappingURL=index.d.ts.map
basant307/AI_Governance_Project · CoolFace