losol / eventuras

Event and conference management system
GNU General Public License v3.0
10 stars 11 forks source link

Markdown viewer supporting notes/callouts #865

Open losolio opened 1 month ago

losolio commented 1 month ago

The task is to extend the markdown view/render component to support making information boxes and warnings from quotes with special formatting-

Markdown examples

Quote

Markdown content:

> This should just become a standard quote

Html render:

<blockquote class="border-l-4 border-gray-300 pl-4 italic text-gray-700 bg-gray-100 dark:bg-gray-800 dark:text-gray-300">
    <p>This should just become a standard quote.</p>
</blockquote>

Information note


> **Information:** This is an example of information.
>
> It may be one line or be only the title

Html render (perhaps)

<div class="border-l-4 border-blue-500 bg-blue-100 p-4 mb-4 text-blue-800 dark:bg-blue-900 dark:text-blue-200">
    <p>This is an example of information.</p>
    <p>It may be one line or be only the title.</p>
</div>

Warning note

> **Warning:** Be warned when making boxes.
>
> It can span several lines. And most people see none of them
> It can even have some **bold** text or links. But we do not support images or other blocks for now. 

Html render (perhaps)

<div class="border-l-4 border-yellow-500 bg-yellow-100 p-4 mb-4 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200">
    <p>Be warned when making boxes.</p>
    <p>It can span several lines. And most people see none of them.</p>
    <p>It can even have some <strong>bold</strong> text or links. But we do not support images or other blocks for now.</p>
</div>

Requirements

References

meinte commented 1 month ago

The standard blockquote is quite simple to implement.

One difficulty up is a blockquote which should alter its behaviour according to whether its warning or information for instance, but even this might be doable by creating a custom component which inspects its content to just to some string comparison and then a little magic

The thing that is worrying it the multiline stuff however, I could be mistaken but I think this would require some pretty custom stuff on both the lexical side(scribo) and the viewer, as right now it doesn't support multiline quotes (though it does seem to support multiline code blocks) - Id have to find out if this is a markdown spec thing, or library specific.