Supercharge Markdown with Laravel
HTML-код
- Опубликовано: 4 авг 2024
- Extending Markdown in Laravel to render blade components and insert ads, newsletter forms, or links to other articles.
You can read some of the code here: aaronfrancis.com/2023/renderi....
---
00:00 Extending Markdown
00:38 Commonmark extensions
02:08 Dangerous Blade rendering
05:27 Safe Blade rendering, the first method
11:19 Adding a safety feature
13:40 Safe Blade rendering, the second method
24:37 Adding inline ads with markdown
29:00 Adding newsletter signups
--- Кино
I am unreasonably happy that you said "I'm the captain now" for (at least) the second time in a video 👏👏👏
The second, and not the last 😂
You might be one of the best and most entertaining teachers on the platform, other than Fireship.
what a great explanation dude 👍
Thanks for amazing video! Was actually dreading trying to figure out how to setup markdown to look nice this week, and now im excited :D
Absolutely love how concise and light-hearted your content is, thankyou for valuing our attention!
Thank you so much
Hey Aron I just saw you got laid off from PlanetScale. I honestly can't believe it since you and your enthusiasm is one of the biggest reasons for its boom in popularity. Please don't stop making content and I hope you will find a much better place for your next employment. I wish you all the best.
The way you narrate is eerily similar to how I actually talk to myself when coding. 😅
Great video! Regarding the safe rendering; I also use Markdown + Blade, however instead of doing it the way you did, I decided to use the package by spatie "sheets". Never thought of the Blade code issue, so I decided to check. And sheets seems to handle it for me already! So perhaps a good choice for some people if you don't mind relying on a 3rd party package
Oh nice! Of course Spatie has a package for it. Does it escape Blade for you?
@@aarondfrancis Looks like it! Created a markdown file with some codeblocks with blade directives inside them and it worked fine, lovely video btw. Your approach to these things is always very informative to me 🤍❤️
@@cptive thank you! ❤️
@@cptive any chance you have a working example? got sheets all set up and works great - but no joy on the blade directives in code blocks
I was caught completely off guard when you switched from dark to light mode without warning. I am now legally blind.
My bad dog
Hey Aaron, great video as always (because PHP). What patern is your way to go for really large Laravel app?
I try to stick as close to the framework conventions as possible!
I was wondering, how did you get that little contextual comment in your var dumper that shows the file containing the function call? Big fan of using var dumper in everything I make, but have never made anything in Laravel. Is it something Laravel does with the var dumper component?
I'm not sure! I think that's a standard laravel thing
Great video, I think that the first option is more safe to use? Am I wrong? 🤔
You're absolutely correct!
2:05 you write your own = first party,
the second party is the user ( aka the ones that visit your site or use your library)
I feel like any Commonmark extensions that ship with Commonmark are first party though? Then what are the ones that I write?
@@aarondfrancis I think first or second party depends on what perspective you're speaking from. if a developer creates an extension then that's first party (to them), but If I use it in my project it's second party(to my project). like, if playstation makes a video game, that's a first party playstation game. but when I make a video game, it's also first party.. just from my perspective...
or something like that haha
i was hoping to see Vue component block along with blade :)
I guess you could do that with the parse annotation!
I'm gonna sue you for surprising me with a light-mode attack at 1:52.
You have been served.
Haha yeah my bad
you are great !! but i have a question can i do mobile app with laravel
You could make the backend API but no, not an actual mobile app
I like to use Laravel, but i want to make a static website; I know is overkill, but should i really check other options or can i do it no problem with Laravel?
There is a package called spatie/export, that can convert a Laravel app into a bundle of static HTML sites. I use it myself for my website. Works great.
@@stefanzweifel thanx, i will look into it!; what hosting platform do you use if I may ask?
Is torchlight/torchlight-laravel not supported in Laravel 11? I'm trying to install it with composer but it fails to install. Seems to be looking for illuminate\support ^7.26.0|^8.0
This happens on a fresh Laravel 11 project.
My end goal is to use the CommonMark extension to properly highlight code blocks in markdown blog posts.
I need to update it! I'll get around to that this week. Sorry for the wait
@@aarondfrancis Thanks a bunch! In the meantime I'm using the Spatie Markdown plugin which has yielded great results so far. I'm actually going to run a short livestream tomorrow night to show others how to use it. Come hang if you have the time ruclips.net/user/liveFdJ4Mg5SrvE?feature=share
# Summary
This video discusses how to extend Markdown in Laravel to enhance its functionality. Aaron Francis demonstrates adding syntax highlighting and Blade component rendering to Markdown.
# Highlights
- 💡 The author extends Markdown to customize its rendering process and achieve the desired appearance for their website.
- 💡 They use the Graham Campbell Markdown package, which is a Laravel adapter for the League's CommonMark package.
- 💡 The author adds the Torchlight extension for syntax highlighting and showcases its capabilities.
- 💡 They explain the issues with running Blade over Markdown-generated HTML and propose safer alternatives.
- 💡 The author demonstrates two approaches: removing code blocks, running Blade, and adding them back, or running Blade over the entire document and reinserting the code blocks.
- 💡 They provide code examples and explain how to enable and disable Blade parsing based on the source of the Markdown content.
- 💡 The author concludes by discussing the pros and cons of each approach and encourages careful consideration when implementing these extensions.
✌
Is markdown a replacement for HTML and XML? Why are so many different markdown languages needed?
Markdown is a nice way to write content. It's not a replacement for anything, you can use it if you like it though
subd cuz of planetscale videos. tell me wat to do now using their competitor and deal
how did you made the twitter card embed so nicely like that?
That's a custom blade component!
@@aarondfrancis I would like that component to have in my projects, could you share please 🫡
who is the second party 🤣
I still don't know 😂
yea i dont understand anything lol