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

Setting that would ignore formatting on specific tags, i.e. <svg> ? #719

Open
yabdab opened this issue Sep 22, 2022 · 9 comments
Open

Setting that would ignore formatting on specific tags, i.e. <svg> ? #719

yabdab opened this issue Sep 22, 2022 · 9 comments
Assignees

Comments

@yabdab
Copy link

yabdab commented Sep 22, 2022

Formatting things like a <svg> tag can take up several lines of code and is not really that necessary.

Now this plugin does an excellent job formatting it, but it adds tons of new lines to my code.

This is just a feature request to allow a setting that ignores certain tags if not too much trouble?

I know I can use {{-- blade-formatter-disable-next-line --}} , but this would be easier if possible 😉

Thanks guys.

@shufo
Copy link
Owner

shufo commented Sep 25, 2022

Thanks for requesting the feature @yabdab

it adds tons of new lines to my code.

From my understand, you are talking about like below code with --wrap-attributes option is set to force-expand-multiline?

$ cat test.blade.php
<svg height="130" width="500">
  <defs>
    <linearGradient id="grad1" x1="0%" y1="0%" x2="100%" y2="0%">
      <stop offset="0%" style="stop-color:rgb(255,255,0);stop-opacity:1" />
      <stop offset="100%" style="stop-color:rgb(255,0,0);stop-opacity:1" />
    </linearGradient>
  </defs>
  <ellipse cx="100" cy="70" rx="85" ry="55" fill="url(#grad1)" />
  <text fill="#ffffff" font-size="45" font-family="Verdana" x="50" y="86">SVG</text>
  Sorry, your browser does not support inline SVG.
</svg>
  $  ./bin/blade-formatter test.blade.php --wrap-attributes force-expand-multiline

<svg
    height="130"
    width="500"
>
    <defs>
        <linearGradient
            id="grad1"
            x1="0%"
            y1="0%"
            x2="100%"
            y2="0%"
        >
            <stop
                offset="0%"
                style="stop-color:rgb(255,255,0);stop-opacity:1"
            />
            <stop
                offset="100%"
                style="stop-color:rgb(255,0,0);stop-opacity:1"
            />
        </linearGradient>
    </defs>
    <ellipse
        cx="100"
        cy="70"
        rx="85"
        ry="55"
        fill="url(#grad1)"
    />
    <text
        fill="#ffffff"
        font-size="45"
        font-family="Verdana"
        x="50"
        y="86"
    >SVG</text>
    Sorry, your browser does not support inline SVG.
</svg>

I agree that it would be a lot of lines.

My personal recommendation is if you are concerned about lines of code, split them into Anonymous Components would be a good solution.

However, I understand that there are some use cases where it is more convenient to ignore certain tags, so I'll give some thought to what we should do.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 5, 2022

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days

@github-actions github-actions bot added the Stale label Dec 5, 2022
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Dec 15, 2022
@shufo shufo reopened this Dec 15, 2022
@github-actions github-actions bot removed the Stale label Dec 16, 2022
@github-actions
Copy link
Contributor

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days

@github-actions github-actions bot added the Stale label Feb 14, 2023
@github-actions github-actions bot removed the Stale label Feb 22, 2023
@github-actions
Copy link
Contributor

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days

@github-actions github-actions bot added the Stale label Apr 24, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale May 5, 2023
@shufo shufo reopened this Jun 12, 2023
@shufo shufo removed the Stale label Jun 12, 2023
@github-actions
Copy link
Contributor

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days

@github-actions github-actions bot added the Stale label Aug 12, 2023
@shufo shufo removed the Stale label Aug 12, 2023
@github-actions
Copy link
Contributor

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days

@github-actions github-actions bot added the Stale label Oct 12, 2023
@shufo shufo removed the Stale label Oct 12, 2023
Copy link
Contributor

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days

@github-actions github-actions bot added the Stale label Dec 12, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Dec 23, 2023
@shufo shufo removed the Stale label Dec 31, 2023
@shufo shufo reopened this Dec 31, 2023
Copy link
Contributor

github-actions bot commented Mar 1, 2024

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days

@github-actions github-actions bot added the Stale label Mar 1, 2024
@github-actions github-actions bot removed the Stale label Mar 8, 2024
Copy link
Contributor

github-actions bot commented May 8, 2024

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days

@github-actions github-actions bot added the Stale label May 8, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale May 18, 2024
@shufo shufo removed the Stale label Aug 12, 2024
@shufo shufo reopened this Aug 12, 2024
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

No branches or pull requests

2 participants