Skip to content

Commit

Permalink
Plugins: Allow specifying render options on renderMarkup command
Browse files Browse the repository at this point in the history
  • Loading branch information
laurent22 committed Nov 14, 2024
1 parent 521cb3e commit 8e3c817
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/app-desktop/commands/renderMarkup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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,
});
Expand Down

0 comments on commit 8e3c817

Please sign in to comment.