F
Filamentβ€’12mo ago
Vladimir

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:
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
Jump to solution
7 Replies
Solution
Dennis Koch
Dennis Kochβ€’12mo ago
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
Vladimir
Vladimirβ€’12mo ago
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.
Dennis Koch
Dennis Kochβ€’12mo ago
prose provides syntax highlighting? πŸ€” Can you maybe show a screenshot of the result?
Vladimir
Vladimirβ€’12mo ago
Yes. Tailwind typography says this about it: Image speaks more then word. πŸ™‚
Vladimir
Vladimirβ€’12mo ago
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"
Dennis Koch
Dennis Kochβ€’12mo ago
Sorry. I thought your question was about syntax highlighting. Not about the prose class.
Vladimir
Vladimirβ€’12mo ago
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. ❀️