Skip to content

Blade syntax is parsed in the '*.md'-files #357

Description

@tobidotYD

Describe the bug
Blade syntax in the '*.md' file is being parsed and fails if invalid syntax is used.

To Reproduce
Steps to reproduce the behavior:

  1. Create an empty .md document in the docs folder
  2. Write just "@can" into that file
  3. Navigate to the file via you browser , where you would expect that document to appear.
  4. See an error message

Expected behavior
The text "@can" should appear on the page.

Screenshots
-- Pasted the error message blow

Desktop (please complete the following information):

  • OS: macOS
  • Browser: Chrome , Firefox ... probably browser independant
  • Version: 123.0.6312.87, 123.0.1

Additional context

Error Message:

ParseError: syntax error, unexpected end of file, expecting "elseif" or "else" or "endif" in /var/www/html/vendor/binarytorch/larecipe/src/Traits/HasBladeParser.php(25) : eval()'d code:1 Stack trace: #0 /var/www/html/vendor/binarytorch/larecipe/src/Models/Documentation.php(80): BinaryTorch\LaRecipe\Models\Documentation->renderBlade() #1 /var/www/html/vendor/binarytorch/larecipe/src/Cache.php(37): BinaryTorch\LaRecipe\Models\Documentation->BinaryTorch\LaRecipe\Models\{closure}() #2 /var/www/html/vendor/binarytorch/larecipe/src/Models/Documentation.php(72): BinaryTorch\LaRecipe\Cache->remember() #3 /var/www/html/vendor/binarytorch/larecipe/src/DocumentationRepository.php(48): BinaryTorch\LaRecipe\Models\Documentation->get() #4 /var/www/html/vendor/binarytorch/larecipe/src/Http/Controllers/DocumentationController.php(63): BinaryTorch\LaRecipe\DocumentationRepository->get() #5 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(54):

...

Also i test a bit more and it seems like this actually is considering "blade"-syntax.
For example :
"@can('allow-all') A @else B @endcan"
actually does not fail, but shows A, or B depending on wether or not the user has that permission.

I could not find that behaviour described in the docs.
Maybe adding a note to the docs, that full on blade syntax is parsed.
If unnoticed you could actually leak sensitive data in the docs.

After digging into closed Issues i found that this came as a feature request:

#138
#177

But it seems rather problematic an unexpected to me, especially if not documented.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions