diff --git a/src/classes/IOClient.ts b/src/classes/IOClient.ts index 9002b4b..ae05a83 100644 --- a/src/classes/IOClient.ts +++ b/src/classes/IOClient.ts @@ -1007,6 +1007,18 @@ export class IOClient { * ``` */ markdown: this.createIOMethod('DISPLAY_MARKDOWN'), + /** + * Displays rendered HTML to the action user. + * + * **Usage:** + * + * ```typescript + * await io.display.html("Message body", { + * html: `

Hello, world!

` + * }); + * ``` + */ + html: this.createIOMethod('DISPLAY_HTML'), /** * Displays an image to the action user. * diff --git a/src/examples/basic/index.ts b/src/examples/basic/index.ts index 2e9bf7e..8e5da7f 100644 --- a/src/examples/basic/index.ts +++ b/src/examples/basic/index.ts @@ -573,6 +573,38 @@ const interval = new Interval({ return 'Pong!' }, }), + html: async () => { + await io.display.markdown('Done!') + + await io.display.html('HTML', { + html: '

Hello, world!

', + }) + + const richText = await io.input.richText('Text', {}) + + await io.display.html('What you entered', { + html: richText, + }) + + await io.display.html('Restricted', { + html: ` +

Heading 2

+ + + + +
+ +
+ + + +

Hello, in red!

+

+ drop table users; + `, + }) + }, inputRightAfterDisplay: async () => { await io.display.link('Display', { url: '', diff --git a/src/ioSchema.ts b/src/ioSchema.ts index db0e25a..9b7058c 100644 --- a/src/ioSchema.ts +++ b/src/ioSchema.ts @@ -476,6 +476,13 @@ const DISPLAY_SCHEMA = { state: z.null(), returns: z.null(), }, + DISPLAY_HTML: { + props: z.object({ + html: z.string(), + }), + state: z.null(), + returns: z.null(), + }, DISPLAY_IMAGE: { props: imageSchema, state: z.null(),