-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
enhancementNew feature or requestNew feature or requestgmnhgIssue related to cmd/gmnhgIssue related to cmd/gmnhgmajorRequires a major refactoring or rewriteRequires a major refactoring or rewritequestionFurther information is requestedFurther information is requested
Description
Just wanted to put this out there for consideration... it would be helpful to have some kind of shortcode processing in gmnhg. Given the variety of shortcodes available, as well as the ability for people to define custom shortcodes, it would make sense to build this around the idea of user-defined templates.
Here's one approach:
- Shortcode templates will be placed in a specified folder and must be named to match the desired shortcode (
highlight.gowould match the built-in{{< highlight >}}shortcode, andfoo/bar.gowould match{{< foo/bar >}}). - Before parsing with gomarkdown, input files are parsed for shortcodes. This process will have to take into account unpaired, paired, and self-closing shortcodes. The templates themselves will have to handle "nested" shortcodes; the parser will not bother with this. This should simplify parsing somewhat.
- Each shortcode template presents a common method with arguments that represent both shortcode parameters (if any) and inner content (if any). The method should return the processed text for rendering.
- Depending on whether the shortcode was called with
{{% %}}(further rendering requested) or{{< >}}(present content without further rendering), the template output will either be inlined with the text and passed to gomarkdown, or it will be set aside for inclusion in the final rendered text as-is. The latter could be accomplished by replacing the template with some kind of temporary token like {{<1>}}, which will be replaced after rendering; there may be better approaches as well.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestgmnhgIssue related to cmd/gmnhgIssue related to cmd/gmnhgmajorRequires a major refactoring or rewriteRequires a major refactoring or rewritequestionFurther information is requestedFurther information is requested