1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-11-19 20:31:46 +02:00

Plugins: Allow specifying render options on renderMarkup command

This commit is contained in:
Laurent Cozic 2024-11-14 21:55:13 +00:00
parent 521cb3e5ad
commit 8e3c81717e

View File

@ -4,6 +4,8 @@ import { CommandRuntime, CommandDeclaration, CommandContext } from '@joplin/lib/
import { themeStyle } from '@joplin/lib/theme';
import attachedResources from '@joplin/lib/utils/attachedResources';
import { MarkupLanguage } from '@joplin/renderer';
import { Options } from '@joplin/renderer/MdToHtml';
import { RenderOptions } from '@joplin/renderer/types';
export const declaration: CommandDeclaration = {
name: 'renderMarkup',
@ -20,9 +22,10 @@ const getMarkupToHtml = () => {
export const runtime = (): CommandRuntime => {
return {
execute: async (_context: CommandContext, markupLanguage: MarkupLanguage, markup: string) => {
execute: async (_context: CommandContext, markupLanguage: MarkupLanguage, markup: string, _rendererOptions: Options = null, renderOptions: RenderOptions = null) => {
const markupToHtml = getMarkupToHtml();
const html = await markupToHtml.render(markupLanguage, markup, themeStyle(Setting.value('theme')), {
...renderOptions,
resources: await attachedResources(markup),
splitted: true,
});