Skip to content
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

Disable interpolation #35

Merged
merged 5 commits into from
Sep 22, 2018
Merged

Disable interpolation #35

merged 5 commits into from
Sep 22, 2018

Conversation

phannaly
Copy link
Contributor

Disable interpolation to allow {{ }} syntax in markdown.
This PR will fix #28

@saleem-hadad
Copy link
Owner

Thank you @phannaly for your contributions 👻. However, I tried this PR, but it seems doesn't solve the problem completely I mean the blade syntax still not rendering! 🧐

@phannaly
Copy link
Contributor Author

@saleem-hadad Have you try rebuilt the assets?

@phannaly
Copy link
Contributor Author

Seems work perfectly for me. if you still have problem, I will check my PR again.
https://i.imgur.com/2uy8j4S.png

@saleem-hadad
Copy link
Owner

Yes correct that what I got also, but this doesn't seem to solve the issue completely (only half of it), because what they are trying to do is to render the blade syntax now showing it as text

@phannaly
Copy link
Contributor Author

ah! sorry I missed the point. I will check it tonight.

@saleem-hadad
Copy link
Owner

Thank you dude for your help and contribution :D

@phannaly
Copy link
Contributor Author

@saleem-hadad can you check these commit again?
I just add commit to render blade syntax then parse to markdown.
As Blade function need Illuminate/view I also update composer.json in require.

@saleem-hadad
Copy link
Owner

Thank you @phannaly so much for your contribution. It works now 👻🔥
But could you please provide a small unit test about this feature before I merge it so later on no one break the changes accidentally?

@phannaly
Copy link
Contributor Author

@saleem-hadad That's okay I just realized I missed unit test.

@phannaly
Copy link
Contributor Author

Just add unit test for check and render blade syntax.

@saleem-hadad
Copy link
Owner

Amazing ❤️😍
Thank you very much @phannaly for your awesome contributions 🎊

@saleem-hadad saleem-hadad merged commit f83938a into saleem-hadad:master Sep 22, 2018
@OwenMelbz
Copy link

@saleem-hadad @phannaly are you sure this has been resolved?

When using 1.2.5 and this markdown..

blade_md_ _giles-docs

I get the blade error

whoops__there_was_an_error_

However when I then I use the blade escape e.g @

blade_md_ _giles-docs

Yes blade ignores it - however Vue still tries to parse it.

_blade_-_giles

The HTML that it outputs is

<pre><code class="language-php">Hello {{ $example }}</code></pre>

@phannaly
Copy link
Contributor Author

phannaly commented Oct 2, 2018

Hi @OwenMelbz Did you already pass $example variable to your markdown file?

@OwenMelbz
Copy link

No because it's documentation giving examples :D

I want the documentation to show users how to do things, and this instance the documentation is explaining how to do something that uses blade syntax with an example variable

@phannaly
Copy link
Contributor Author

phannaly commented Oct 2, 2018

@OwenMelbz You have to pass your $variable from DocumentationController inside show() method so markdown file will clearly know what it is.
@saleem-hadad Can you make docs for this or need some PR?

@OwenMelbz
Copy link

@phannaly This doesn't make sense.

This package is for Writing documentation.

It becomes useless if you try parse the code, meaning people cannot write code examples.

--

For example, lets just say you were trying to inform your users how to pass data from a controller to your view, you might write something like... (using laravel as an example).

Please imagine below is the documentation I want to write:

EXAMPLE START

First you need to set up your route e.g.

Route::get('/', 'HomeController');

Once you've defined your route, you can make your controller e.g.

<?php

namespace App\Http\Controllers;

class HomeController
{
    public function __invoke()
    {
        return view('home')->with('message', 'Hello World');
    }
}

Now within your blade template e.g. home.blade.php you can display your $message variable e.g.

@extends('layout.app')

@section('content')
    <h1>{{ $message }}</h1>
@endsection

EXAMPLE END


You can see here that I'm simply describing how to display a variable in blade.

What you're saying is that I need to pass a variable from the controller to the docs... this doesn't make sense.

Hopefully you understand why this is wrong.

Thanks

@phannaly
Copy link
Contributor Author

phannaly commented Oct 2, 2018

@OwenMelbz That's why I ask creator to create docs.

@OwenMelbz
Copy link

@phannaly but how can we now do the above?

It was working before the PR was merged I believe

@OwenMelbz
Copy link

@saleem-hadad what’s going on with this please? We’ve just spent ages writing our docs in your tool, loving the product, now it’s currently unusable and really hoping you can find a solution :(

@saleem-hadad
Copy link
Owner

sorry guys I didn't get notification about what's going on here

@saleem-hadad
Copy link
Owner

I'll check now

@saleem-hadad
Copy link
Owner

screenshot 2018-10-06 at 3 21 47 pm

Is that what you're looking for? @OwenMelbz it works by writing the docs like this
screenshot 2018-10-06 at 3 22 37 pm

It's a quick solution for now till we find a better one for sure

@saleem-hadad
Copy link
Owner

I used the latest version v1.2.5

@OwenMelbz
Copy link

@saleem-hadad Maybe something else is needed to get this working on existing projects?

e.g. This is our composer installed versoin

➜ composer show | grep "lare"
binarytorch/larecipe                  v1.2.5   Generate gorgeous recipes ...

This is a markdown file

# 🔪 Blade

---

```php
hello {{ $test }}
```

This is the error

screen shot 2018-10-07 at 16 34 44

--

@saleem-hadad Perhaps I could share the code-base with you privately to see if you can replicate?

@saleem-hadad
Copy link
Owner

@OwenMelbz no problem I'd be happy to help 😇
but as I told you just add "@" before any variable you have. e.g. "@{{ $test }}" instead of "{{ $test }}"

and make sure you publish the new assets

php artisan vendor:publish --tag=larecipe_assets --force

If noting works, add me to the repo temporarly to try fixing the issue.

@OwenMelbz
Copy link

Publishing the new assets seemed to be the fix here!

After that it worked as expected :P

Was that listed somewhere that I missed, or does it need adding?

Thanks :)

@saleem-hadad
Copy link
Owner

Cool, sounds great 😍

Yead dude, it's mentioned in the upgrade section
but nevermind :D
Good luck with your project/package @OwenMelbz 😍please share it with us if you can once you publish it, we'll be happy to see it live

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Blade syntax break resolution
3 participants