-
-
Notifications
You must be signed in to change notification settings - Fork 138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parse Markdown before parsing blade syntax? #67
Comments
We don't do this because blade syntax itself could be recognised by mistake as markdown, and thus, the file broken. |
Right, I see. I'll see if I could make a blade syntax e.g. |
That would work for sure. Would be pretty easy to implement. |
Hmm, well, actually, not quite. Only if there was no other blade in between those annotations. |
Instead, I'd recommend moving your markdown parts to separate .md.blade.php file, then including that from a .blade.php file. |
Just in case anyone wants to reference this. Here is what I ended up implementing (as @GrahamCampbell suggested). I'm specifically doing this for a release notes page but aiming to reuse the code for other static markdown pages in the future as well, hence the structure... routes.php:
MarkdownPagesController.php:
views/layouts/markdown.blade.php:
views/pages/release-notes.md:
The code above generates a page like this for http://localhost/pages/release-notes:
|
In
BladeMarkdownEngine::get()
the code is as follow:My
.md.blade.php
contains@extends('layouts.default')
. This means thatparent::get()
has already parsed my blade template and puts loads of HTML into$contents
.When
convertToHtml()
, which supposed to get only Markdown syntax, gets the fully parsed HTML above, it goes crazy and hence lots of<pre><code>
produced.Is it possible to specify that markdown content in
.md.blade.php
should be parsed before parsing the rest of blade syntax in that file? If it's not already supported would you welcome a PR that allows that?The text was updated successfully, but these errors were encountered: