Prevent new line in certain html tags
I have a paragraph and because I use bold text in a portion of the paragraph, when I auto-format the code, it places the <b> tab in a new line.
How to stop this please?
Thank you
Before
<p>A smile makeover is a customised treatment plan designed to create a <b>straighter, brighter, and more aesthetically pleasing smile</b>. It often combines several cosmetic dental treatments tailored to your unique needs and goals to enhance the appearance of your teeth and overall smile.</p>
After<p>A smile makeover is a customised treatment plan designed to create a <b>straighter, brighter, and more aesthetically pleasing smile</b>. It often combines several cosmetic dental treatments tailored to your unique needs and goals to enhance the appearance of your teeth and overall smile.</p>
请先登录再写评论。
Unfortunately I failed to reproduce the problem.
Could you share your code style preferences (
<IDE config dir>/codestyles/<scheme name>.xmlif you are using IDE-level scheme, or.idea\codeStyles\Project.xmlwhen using a project scheme) plus a file that reproduces the issue so we can continue the investigation?Hi Elena,
This is what I have, Default.xml
You can use the above paragraph as a test. I want the <b<bold text</b> to stay in the same line and not start a new line.
thank you
<code_scheme name="Default" version="173"><option name="AUTODETECT_INDENTS" value="false" /><option name="OTHER_INDENT_OPTIONS"><value><option name="USE_TAB_CHARACTER" value="true" /><option name="SMART_TABS" value="true" /></value></option><HTMLCodeStyleSettings><option name="HTML_UNIFORM_INDENT" value="true" /><option name="HTML_ATTRIBUTE_WRAP" value="0" /><option name="HTML_TEXT_WRAP" value="0" /><option name="HTML_ELEMENTS_TO_REMOVE_NEW_LINE_BEFORE" value="br,b,i" /><option name="HTML_INLINE_ELEMENTS" value="a,abbr,acronym,basefont,bdo,big,br,cite,cite,code,dfn,em,font,i,img,input,kbd,label,q,s,samp,select,small,span,strike,strong,sub,sup,textarea,tt,u,var" /><option name="HTML_DONT_ADD_BREAKS_IF_INLINE_CONTENT" value="title,h1,h2,h3,h4,h5,h6,p,b,i" /><option name="HTML_ENFORCE_QUOTES" value="true" /></HTMLCodeStyleSettings><PHPCodeStyleSettings><option name="ATTRIBUTES_WRAP" value="0" /></PHPCodeStyleSettings><codeStyleSettings language="HTML"><indentOptions><option name="USE_TAB_CHARACTER" value="true" /><option name="SMART_TABS" value="true" /></indentOptions></codeStyleSettings><codeStyleSettings language="Markdown"><indentOptions><option name="USE_TAB_CHARACTER" value="true" /><option name="SMART_TABS" value="true" /></indentOptions></codeStyleSettings><codeStyleSettings language="PHP"><option name="RIGHT_MARGIN" value="0" /><option name="CLASS_BRACE_STYLE" value="1" /><option name="METHOD_BRACE_STYLE" value="1" /><option name="WRAP_ON_TYPING" value="0" /><indentOptions><option name="USE_TAB_CHARACTER" value="true" /><option name="SMART_TABS" value="true" /></indentOptions></codeStyleSettings></code_scheme>Thank you.
Here is a result of formatting HTML using your code style preferences:
As you can see,
<b>is not moved to a new line for me.Do you use Prettier or
.editorconfigin your project? They can override the IDE own code style preferences.Also, is the file you are editing a plain HTML, or the other file type (PHP, etc.)?Hi Elena,
That looks good, but it doesn't work on mine for some reason. Prettier is disabled and I don't use .editorconfig.
Any other clues?
Thank you
Hi Otto,
Can you reproduce the issue in a brand new project? Also, is the file you are editing a plain HTML, or the other file type (PHP, etc.)?
Hi Elena,
I have tried on a brand new created project. I've tried it with a html file. I still have the same issue. :(
Thank you
Before
After
Hi Elena, how can i do that please?
Hi Elena,
Here it is, thank you.
Upload id: 2026_07_27_nYJcHpb9i5omHjubaUPZgQ (file: test.zip)
Still no luck with reproducing the issue. I've copied my code style settings to the project and uploaded it to https://limewire.com/d/9xB9q#0sPGwCKLzo. Could you check if you can reproduce the issue in it? Just to make sure that we are on the same page.
Hi Elena,
Can I export my Code Style Scheme with you and you can try that please?
Thank you
Please open your project in PhpStorm, go to Settings | Editor | Code Style, choose to copy the code style scheme to project:
Then close the project, zip it along with the
.ideafolder and re-upload it.