knuckleswtf / scribe

Generate API documentation for humans from your Laravel codebase.✍
https://scribe.knuckles.wtf/laravel/
MIT License
1.7k stars 303 forks source link

Dynamic url for base_url suggestion not working #796

Closed mnowak-umich closed 6 months ago

mnowak-umich commented 8 months ago

Scribe version

4.29.0

PHP version

8.3.0

Framework

Laravel

Framework version

10.42.0

Scribe config

title => "CHCR CRM API"
base_url => "{{ config(\"app.url\") }}"
type => "laravel"
theme => "elements"
laravel.add_routes => false
try_it_out.base_url => "{{ config(\"app.url\") }}"
auth.enabled => true
postman.enabled => false
openapi.enabled => false

What happened?

The base_url is not being embedded in the index.blade.php file as is, but is being encoded with entities, causing the blade processing to fail.

So for example, on lines 24-28 of the index.blade.php file, you get:

<script>

            var tryItOutBaseUrl = "{{ config(&quot;app.url&quot;) }}";

            var useCsrf = Boolean();

            var csrfUrl = "/sanctum/csrf-cookie";

        </script>

Also on line 435 you get:

which causes a parse exception: syntax error, unexpected token "&"

I think the the single quotes in the base url which be copied as is, like:


or:

<div title="{{ config('app.url') }}/api/initial-load" class="sl-stack sl-stack--horizontal sl-stack--3 sl-inline-flex sl-flex-row sl-items-center sl-max-w-full sl-font-mono sl-py-2 sl-pr-4 sl-bg-canvas-50 sl-rounded-



### Docs

- [X] I've checked [the docs](https://scribe.knuckles.wtf/laravel), the [troubleshooting guide](https://scribe.knuckles.wtf/laravel/troubleshooting), and [existing issues](https://github.com/knuckleswtf/scribe/issues?q=is%3Aissue+), but I didn't find a solution
shalvah commented 6 months ago

Ah, I see. I think unescaping ({!! !!}) should correct that. I'll adjust it.