lazee/premonition

Block title not taken into account when block type is not defined in _config.yml

MaximeKjaer opened this issue · 4 comments

The current implementation of create_resource does not use the title of a block if the block type is not a "default block", and is not defined in the _config.yml

For instance, if I don't specify any configuration in _config.yml and write the following block:

> test "hello"
> This is a test

Then the following will be output:

<div class="premonition test">
	<div class="fa fa-check-square"></div>
	<div class="content">
		<p>This is a test</p>
	</div>
</div>

Seeing that the default template is:

<div class="premonition {{type}}">
  <div class="fa {{meta.fa-icon}}"></div>
  <div class="content">{% if header %}<p class="header">{{title}}</p>{% endif %}{{content}}</div></div>

I would expect a <p class="header"> to be generated as well, but it isn't. Is this intended behavior?

To fix this in the short term, I'm able to do the following config, which makes the plugin generate a <p class="header">.

premonition:
  types:
    test:
      id: test
lazee commented

Its actually by design since test is not a box type. Actually I think we should render an error (with tip on how to implement types) instead of the box itself when using an undefined box type.

lazee commented

image

Actually this is my suggested solution in the v4 branch

lazee commented

I'm quit satisified with this solution. Will be part of the v4 release soon #18