frctl / twig

Use Twig templates with Fractal.
32 stars 34 forks source link

Component notes not working when using twigAdapter as docs engine #45

Closed maximedaoust closed 4 years ago

maximedaoust commented 4 years ago

Setting the fractal.docs.engine(twigAdapter); work as expected for markdown files located in the folder defined by fractal.docs.set('path', ...);, but it seem to break the note panel / note templating engine for a component with a readme.md (https://fractal.build/guide/components/notes.html#the-readme-md-file)

It still break even if I simply use plain text, nothing related to twig. The error only occurs on component with a readme.md file.

And this is the error in question :

 (C:\projects\_internal\frontend-structure\_frontend\node_modules\@frctl\mandelbrot\views\pages\components\detail.nunj)
  Template render error: (C:\projects\_internal\frontend-structure\_frontend\node_modules\@frctl\mandelbrot\views\partials\pen\browser.nunj)
  Template render error: (C:\projects\_internal\frontend-structure\_frontend\node_modules\@frctl\mandelbrot\views\partials\browser\browser.nunj)
  Template render error: (C:\projects\_internal\frontend-structure\_frontend\node_modules\@frctl\mandelbrot\views\partials\browser\panel-notes.nunj)
  TypeError: The "to" argument must be of type string. Received type object

image

maximedaoust commented 4 years ago

It seem related to path being null (since typeof null === 'object') here : https://github.com/frctl/fractal/blob/1c708d9442bd34c8cab329fcd2abf6a98e922c37/src/api/docs/source.js#L83 https://github.com/frctl/fractal/blob/1c708d9442bd34c8cab329fcd2abf6a98e922c37/src/api/docs/source.js#L107