diff --git a/packages/astro-remote/index.ts b/packages/astro-remote/index.ts index 6e92355..d2e4ca5 100644 --- a/packages/astro-remote/index.ts +++ b/packages/astro-remote/index.ts @@ -1,2 +1,5 @@ + +/** Markdown HTML Renderer */ export { default as Markdown } from "./lib/Markdown.astro"; +/** HTML Renderer */ export { default as Markup } from "./lib/Markup.astro"; diff --git a/packages/astro-remote/lib/Markdown.astro b/packages/astro-remote/lib/Markdown.astro index 4d29469..8977129 100644 --- a/packages/astro-remote/lib/Markdown.astro +++ b/packages/astro-remote/lib/Markdown.astro @@ -4,9 +4,37 @@ import { createComponentProxy, markdown } from './utils'; import type { MarkedExtension } from 'marked'; export interface Props { + /** The markdown content to be rendered. If not provided, the content will be taken from the default slot. + * @example + * + + */ content?: string; + /** Allows the user to define custom SanitizeOptions to be used when rendering the markdown. + * @example + * + + */ sanitize?: SanitizeOptions; + /** Allows the user to pass in custom components to be used when rendering the markdown. + * @example + * + + */ components?: Record; + /** Allows usage of Marked extensions to use when rendering the markdown. + * @example + * + + */ marked?: { extensions?: MarkedExtension[] } diff --git a/packages/astro-remote/lib/Markup.astro b/packages/astro-remote/lib/Markup.astro index af71a91..4e2719e 100644 --- a/packages/astro-remote/lib/Markup.astro +++ b/packages/astro-remote/lib/Markup.astro @@ -3,8 +3,29 @@ import type { SanitizeOptions } from 'ultrahtml/transformers/sanitize' import { createComponentProxy, html } from './utils'; export interface Props { + /** The HTML content to be rendered. If not provided, the content will be taken from the default slot. + * @example + * + + */ content?: string; + /** Allows the user to define custom SanitizeOptions to be used when rendering the HTML. + * @example + * + + */ sanitize?: SanitizeOptions; + /** Allows the user to pass in custom components to be used when rendering the HTML. + * @example + * + + */ components?: Record; } diff --git a/packages/playground/src/pages/index.astro b/packages/playground/src/pages/index.astro index 4e45389..57cf273 100644 --- a/packages/playground/src/pages/index.astro +++ b/packages/playground/src/pages/index.astro @@ -1,33 +1,4 @@ --- -import { Markdown, Markup } from "astro-remote"; -import CodeSpan from "../components/CodeSpan.astro"; -import CodeBlock from "../components/CodeBlock.astro"; -import Heading from "../components/Heading.astro"; -import Note from "../components/Note.astro"; - -const example = await fetch("https://example.com/").then((res) => res.text()); -const readme1 = ` -# Hello \`world\` - -> **Note** -> Some note - -> **Warning** -> Some warning - -"Nice" [^1] - -\`\` - -\`inline\` - -\`\`\`html filename="cool" -
Hello world!
-\`\`\` - -[^1]: A footnote on the label: "1". -`; -const readme2 = await fetch("https://raw.githubusercontent.com/natemoo-re/astro-remote/main/packages/astro-remote/README.md").then((res) => res.text()); --- diff --git a/packages/playground/src/pages/test-html.astro b/packages/playground/src/pages/test-html.astro index 5349c71..bc26027 100644 --- a/packages/playground/src/pages/test-html.astro +++ b/packages/playground/src/pages/test-html.astro @@ -18,7 +18,7 @@ const example = await fetch("https://example.com/").then((res) => res.text()); diff --git a/packages/playground/src/pages/test-md-local.astro b/packages/playground/src/pages/test-md-local.astro index 8f3e88c..857ef6b 100644 --- a/packages/playground/src/pages/test-md-local.astro +++ b/packages/playground/src/pages/test-md-local.astro @@ -45,7 +45,8 @@ const readme = `

Test: Markdown-Internal(MD Parse and write)

Test Generated from: "Internal Defined Markdown"

- diff --git a/packages/playground/src/pages/test-md-remote.astro b/packages/playground/src/pages/test-md-remote.astro index 58f148d..4c47449 100644 --- a/packages/playground/src/pages/test-md-remote.astro +++ b/packages/playground/src/pages/test-md-remote.astro @@ -19,7 +19,8 @@ const readme = await fetch("https://raw.githubusercontent.com/natemoo-re/astro-r

Test: Markdown-External(MD Parse and write)

Test Generated from: "https://raw.githubusercontent.com/natemoo-re/astro-remote/main/packages/astro-remote/README.md"

-