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>

0
4 comments

Unfortunately I failed to reproduce the problem.

Could you share your code style preferences (<IDE config dir>/codestyles/<scheme name>.xml if you are using IDE-level scheme, or .idea\codeStyles\Project.xml when using a project scheme) plus a file that reproduces the issue so we can continue the investigation?

0

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>

0

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 .editorconfig in 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.)?

0

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

0

Please sign in to leave a comment.