IShortcode
Pennington.Markdown.Shortcodes
Handler for a named shortcode invocation expanded before Markdig parsing. Implementations are registered as DI services and dispatched by Name (case-insensitive). The string returned by ExecuteAsync is spliced into the markdown source and then parsed as markdown — return raw HTML when the output should bypass markdown processing (use HTML block syntax so Markdig leaves it intact).
Properties
Namestring- Case-insensitive name used to dispatch
<?# Name ... ?>invocations.
Methods
ExecuteAsync
#public Task<string> ExecuteAsync(ShortcodeInvocation invocation, ShortcodeContext context, CancellationToken cancellationToken)
Produces the replacement text for one invocation. invocation carries the parsed arguments and inline content (null for self-closing tags); context carries the host page's route and metadata.
Parameters
invocationShortcodeInvocationcontextShortcodeContextcancellationTokenCancellationToken
Returns
Task<string>Pennington.Markdown.Shortcodes.IShortcode
namespace Pennington.Markdown.Shortcodes;
/// Handler for a named shortcode invocation expanded before Markdig parsing. Implementations are registered as DI services and dispatched by Name (case-insensitive). The string returned by ExecuteAsync is spliced into the markdown source and then parsed as markdown — return raw HTML when the output should bypass markdown processing (use HTML block syntax so Markdig leaves it intact).
public interface IShortcode
{
/// Produces the replacement text for one invocation. invocation carries the parsed arguments and inline content (null for self-closing tags); context carries the host page's route and metadata.
public Task<string> ExecuteAsync(ShortcodeInvocation invocation, ShortcodeContext context, CancellationToken cancellationToken)
;
/// Case-insensitive name used to dispatch <?# Name ... ?> invocations.
public string Name { get; }
}