On Fri, Jul 27, 2018, 8:46 AM Jason E Bailey <[email protected]> wrote:
> In line > > - Jason > > On Thu, Jul 26, 2018, at 7:18 PM, Robert Munteanu wrote: > > Hi, > > > > I've been toying around with a Markdown resource provider in the > > whiteboard [0]. It's very much a work-in-progress but since it does > > something - aka render Markdown files, including support for arbitrary > > Sling properties, I would like to discuss a couple of design decisions. > > > > 1. The resource is created from a markdown file in the following way: > > > > - if a first level heading is found, place the text into jcr:title > > - if a YAML front matter is found, save the properties in the resource > > properties > > Not understanding the phrase "front matter" in it's usage here > I'm assuming YAML front matter like is used in Jekyll. Correct? > > - render everything else as HTML into jcr:description > > > > I am not sure that rendering the markdown in the resource provider is > > the best way. On one hand, it keeps everything simple and does not > > require special work in the rendering script. On the other hand, > > rendering JSON/TXT with HTML inside is not that nice. > > I think it depends on the use case. From my experience there is already a > lot of text strings with HTML inside of it, so I don't see this as > something unique. Not looking at the code yet, but I assume that this is > being rendered when the resource is being requested. Which is something > that I would prefer. > > > > > 2. Only files with the 'md' extension are handled, all others are > > ignored. > > > > To generate static sites, usually markdown files are mixed with images, > > css, js files. Does it make sense to 'pass-through' these files and > > expose them as plain files? There could be some ties with the > > FsResourceProvider. Alternatively the static assets can be placed in a > > different subtree. > > > > Thoughts? > > My first thought after reading the last paragraph was - Wouldn't it be > cool if the FsResourceProvider was extensible so that specific files could > be rendered in a specific manner, then you could add a MarkDown Handler and > it would make it easier for other people to add custom handlers or to > extend existing one for specific requirements. > Agreed! This mechanism could be useful for XML or JSON files as well. Imagine if one could register an XSLT handler and just have Sling serve the rendered HTML for a dump of XML files. > > > Thanks, > > > > Robert > > > > [0]: > > > https://github.com/apache/sling-whiteboard/tree/master/mdresourceprovider >
