-- lx-bundle:true

--- Experimental Markdown adapter for the shared core preview engine
-- @module plugins.mdpreview2

local open_handler = require("core.open_handler")

--- Create an experimental Markdown preview only when explicitly selected
-- @param request table shared open request
-- @return table view experimental Markdown preview
local function create_preview(request)
	local MarkdownPreview2 = require("plugins.mdpreview2.view")

	return MarkdownPreview2(request.doc, request.options)
end

-- Explicit selection keeps the proof of concept from changing normal Markdown opens
open_handler.register({
	name = "markdown2",
	automatic = false,
	formats = { "md" },
	modes = { "preview" },
	create_view = create_preview,
})
