Skip to content

[FR] Add support for custom blocks defined through the API#15

Description

@madx

Hi 馃憢馃徎 I'm @madx from Twitter and we recently discussed about being able to define custom blocks through the API, so that consumers of Knap can extend the engine. Here's the formal feature request 馃檹馃徎 馃槃

Context: I'm the author of Blueprint, a templating plugin for Obsidian that uses Nunjucks under the hood and that allows users to have a mechanism to update all notes using a given template after the template itself has been updated.

Knap looks fantastic and infinitely more modern than Nunjucks, which has poor support for modern async/await syntax, lots of code about handling file system or platform specific issues, as well as template compiler which is useful for a web app but not really for markdown. On top of that, it is geared towards producing HTML, not Markdown, which sometimes can make it a little bit inconvenient.

I would love to be able to switch to Knap, but there's one thing that doesn't exist and it is custom blocks, with the {% blockname "arguments", ... %} block content {% endblockname %} syntax.

I've looked at the source code and all current blocks are statically defined in the parser so it is probably not easy to add.

Is that something you would be willing to add to Knap? I'd be happy to provide more details and help with implementation.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions