Markdown Editor - how to properly display content?
https://filamentphp.com/docs/3.x/forms/fields/markdown-editor
I am rewriting existing project, and wondering How do i show the value of $post->body markdown on 'front end' part?
1) Created a blog post using Filament markdown editor
2) Display a page on public site eg. /blog/how-to-display-makrdown
I get something like first image
So i tried to print it out with Str::markdown($post->body) but this brings not really nicely formatted output like image 2.
Desired output is like image 3
Solution:Jump to solution
Third image uses a syntax highlighter which is no default markdown output. Search for one that fits you and add it to your project. This is not really related to Filament
7 Replies
Solution
Third image uses a syntax highlighter which is no default markdown output. Search for one that fits you and add it to your project. This is not really related to Filament
Figured it out. Actually, this is a matter of presentation, added a 'prose' to the div class and got it displayed as i want.
Thanks π
This shall not be marked as solution, as it is a merrely information.
prose
provides syntax highlighting? π€
Can you maybe show a screenshot of the result?Yes. Tailwind typography says this about it:
Image speaks more then word. π
from docs: "a set of prose classes you can use to add beautiful typographic defaults to any vanilla HTML you donβt control, like HTML rendered from Markdown, or pulled from a CMS"
Sorry. I thought your question was about syntax highlighting. Not about the
prose
class.my question was not about prose class. Was about how to achieve that, and i thank you that you said its not filament related π And you are right, it is not.
β€οΈ