You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Carsten Ziegeler <cz...@apache.org> on 2020/08/27 06:54:21 UTC
[RT] Markdown resource decorator
Hi,
I created a markdown resource decorator module ( [1] ) based on Robert's
md resource provider.
With a decorator you can decorate resources from any provider, so you
can handle file resources, JCR resources etc.
Based on configuration it can extract a yaml frontmatter, title and
render the md to markdown - all of this gets put as additional
attributes into the value map of the decorated resource. (Similar to the
md resource provider)
I've also added initial code for link rewriting in the rendered html.
The solution is more flexible than the md resource provider but is
missing the index feature of that provider.
Right now, the md is rendered as html on first access of the value map.
This could be made more lazy by putting a Supplier into the value map
which triggers rendering the first time the Supplier is used.
[1]
https://github.com/apache/sling-whiteboard/tree/master/mdresourcedecorator
Regards
Carsten
--
Carsten Ziegeler
Adobe Research Switzerland
cziegeler@apache.org
Re: [RT] Markdown resource decorator
Posted by Carsten Ziegeler <cz...@apache.org>.
Thanks, good idea, I'll add something like that
Regards
Carsten
Am 27.08.2020 um 12:09 schrieb Bertrand Delacretaz:
> Hi,
>
> On Thu, Aug 27, 2020 at 8:54 AM Carsten Ziegeler <cz...@apache.org> wrote:
>> ...I created a markdown resource decorator module ( [1] ) based on Robert's
>> md resource provider...
>
> Great idea, looks useful!
>
> One idea that comes to mind is providing a hook to set a specific
> resource type based on the front matter, path or other attributes. Or
> use a specific front matter property for that, like JBake that we use
> for the Sling website does with the "type" front matter property.
>
> -Bertrand
>
--
--
Carsten Ziegeler
Adobe Research Switzerland
cziegeler@apache.org
Re: [RT] Markdown resource decorator
Posted by Bertrand Delacretaz <bd...@apache.org>.
Hi,
On Thu, Aug 27, 2020 at 8:54 AM Carsten Ziegeler <cz...@apache.org> wrote:
> ...I created a markdown resource decorator module ( [1] ) based on Robert's
> md resource provider...
Great idea, looks useful!
One idea that comes to mind is providing a hook to set a specific
resource type based on the front matter, path or other attributes. Or
use a specific front matter property for that, like JBake that we use
for the Sling website does with the "type" front matter property.
-Bertrand
Re: [RT] Markdown resource decorator
Posted by Robert Munteanu <ro...@apache.org>.
Hi Carsten,
On Thu, 2020-08-27 at 08:54 +0200, Carsten Ziegeler wrote:
> Hi,
>
> I created a markdown resource decorator module ( [1] ) based on
> Robert's
> md resource provider.
>
> With a decorator you can decorate resources from any provider, so
> you
> can handle file resources, JCR resources etc.
>
> Based on configuration it can extract a yaml frontmatter, title and
> render the md to markdown - all of this gets put as additional
> attributes into the value map of the decorated resource. (Similar to
> the
> md resource provider)
>
> I've also added initial code for link rewriting in the rendered html.
>
> The solution is more flexible than the md resource provider but is
> missing the index feature of that provider.
Looks good!
Robert
>
> Right now, the md is rendered as html on first access of the value
> map.
> This could be made more lazy by putting a Supplier into the value
> map
> which triggers rendering the first time the Supplier is used.
>
>
> [1]
> https://github.com/apache/sling-whiteboard/tree/master/mdresourcedecorator
>
> Regards
> Carsten
> --
> Carsten Ziegeler
> Adobe Research Switzerland
> cziegeler@apache.org