<p>Rich Text fields in Craft have several options to them that can affect code output. In your field settings, make sure you don't have <code>Clean up HTML?</code> ticked. As the description reads, this option:</p>

<blockquote>
  <p>Removes spans, empty tags, and most style attributes on save.</p>
</blockquote>

<p>Without seeing your field, this is a wild guess at what could be the problem.</p>

CC BY-SA 3.0
2015-03-10T12:05:28.507Z
Thanks Jamie, I forgot to mention that the `Clean up HTML?` field is unchecked. I'll add that to my question for clarity.
Michael Thomas
CC BY-SA 3.0
2015-03-10T12:06:05.573Z
@MichaelThomas Ah, in that case ignore me! :)
Jamie Wade
CC BY-SA 3.0
2017-07-10T13:41:10.547Z
If you want to get your hack on change line 4295 to if (this.utils.isCurrentOrParent('PRE')) return;
JP DeVries
CC BY-SA 3.0
2015-03-10T12:04:02.947Z
2015-03-10T12:04:02.947Z
Jamie Wade
<p>On a fairly fresh site (and also on some more built up sites) I noticed that Redactor is preventing you from doing the following:</p>

<ol>
<li>Create a heading such as an H1 or H2 with two or more words</li>
<li>Select only one of the words in the heading</li>
<li>Attempt to apply styling, such as bold or italic to that word</li>
</ol>

<p>This should result in some simple markup such as:</p>

<pre><code>&lt;h1&gt;My list of &lt;strong&gt;words&lt;/strong&gt;&lt;/h1&gt;
</code></pre>

<p>But it does not apply this styling.</p>

<p>Is this a bug with redactor? Intended behavior? Do you know a clever work around that would utilize Redactor's native buttons?</p>

<p>Edit:</p>

<ul>
<li>The <code>Clean Up HTML?</code> field is unchecked on this redactor settings type.</li>
<li>This bug seems to be a redactor bug, it exists on <a href="http://imperavi.com/redactor/" rel="nofollow">http://imperavi.com/redactor/</a></li>
</ul>

CC BY-SA 3.0
2015-03-10T16:48:15.603Z
Looks like a Redactor bug to me, too. I've send them an email about it.  Going to vote to close this question as it's a bug.
Brad Bell
CC BY-SA 3.0
2015-05-22T13:28:00.947Z
Did they respond back on that bug report, Brad? This issue is not a minor one (you can't string / em in headings!), but still exists on 10.1.1, which you can test on http://imperavi.com/redactor/.
carlcs
CC BY-SA 3.0
2015-05-27T10:35:27.260Z
@BradBell forgot the at-mention with the previous comment. So now again, did they respond? I just checked and they released 10.1.2 in the meantime, but the bug's still not fixed. :(
carlcs
CC BY-SA 3.0
2015-05-27T15:54:46.473Z
@carlcs - Oops. Forgot to update with their response, which I don't really agree with. `"For code streamlining purposes and to implement more of best practices and to improve compatibility, Redactor doesn't allow inline styling of headings (starting with version 10); please, advise your client to use CSS instead, whenever possible."`
Brad Bell
CC BY-SA 3.0
2015-05-27T15:55:12.177Z
@carlcs So essentially "Bug Status: Closed Won't Fix".
Brad Bell
CC BY-SA 3.0
2015-05-27T16:09:56.020Z
@BradBell WHAT?? This isn't true.
carlcs
CC BY-SA 3.0
2015-05-27T16:10:56.287Z
Do they mention any references for their "best practices"?
carlcs
CC BY-SA 3.0
2015-05-27T17:24:10.693Z
@carlcs Nope... makes no sense to me, either.
Brad Bell
CC BY-SA 3.0
2015-05-28T12:00:38.107Z
@BradBell Not to belabor the issue, but how is a client end-user supposed to achieve the desired result "use[ing] CSS instead"? My question is how can a portion of a heading be emphasized or bolded? The only way to target words within a tag is by placing another tag inside said heading, which is what they won't support.
Michael Thomas
CC BY-SA 3.0
2015-06-16T19:59:23.087Z
I had to edit redactor.js to get this to work, what a joke. Line 4165 comment out: if (this.utils.isCurrentOrParent('PRE') || this.utils.isCurrentOrParentHeader()) return;
Simon
CC BY-SA 3.0
2015-07-07T16:35:35.433Z
I received a similar response from Imperavi. It seems like our options are either to toggle code view and add tags manually or to build a custom redactor plugin to handle the desired heading functionality.
Jim Butts
CC BY-SA 3.0
2015-09-29T14:23:03.627Z
I'm just starting to get into Craft, and am evaluating its suitability for a site with significant text formatting. From what I've seen, Redactor seems like more of a liability than anything else... it doesn't even have a "Remove Styles" button, FFS. So if you accidentally bold something, good luck unbolding it without diving into the source! What are the chances of Craft switching over to a different, more mature WYSIWYG editor, such as CK Editor?
Sandwich
CC BY-SA 3.0
2015-10-26T17:56:11.383Z
Imperavi released Redactor II 1.0.2 today and *finally* added inline formatting in headings and tables. Please re-open so I can add an answer, thanks! @Simon
carlcs
CC BY-SA 3.0
2015-10-26T17:59:52.490Z
@BradBell you did not yet abandon Redactor for future Craft releases (2.5, 3.0), did you?
carlcs
CC BY-SA 3.0
2015-10-26T18:03:09.587Z
@carlcs Nope. Redactor II will be in 2.5.
Brad Bell
<redactor>
Redactor won't allow simple styling in heading tags
# Redactor won't allow simple styling in heading tags

(Asked by: username_0 on 2015-03-10)

On a fairly fresh site (and also on some more built up sites) I noticed that Redactor is preventing you from doing the following:

Create a heading such as an H1 or H2 with two or more words
Select only one of the words in the heading
Attempt to apply styling, such as bold or italic to that word

This should result in some simple markup such as:
My list of words

But it does not apply this styling.
Is this a bug with redactor? Intended behavior? Do you know a clever work around that would utilize Redactor's native buttons?
Edit:

The Clean Up HTML? field is unchecked on this redactor settings type.
This bug seems to be a redactor bug, it exists on http://imperavi.com/redactor/

**Tags:** redactor

> **Comments:**
> **username_1**: Looks like a Redactor bug to me, too. I've send them an email about it.  Going to vote to close this question as it's a bug.  
> **username_2**: Did they respond back on that bug report, Brad? This issue is not a minor one (you can't string / em in headings!), but still exists on 10.1.1, which you can test on http://imperavi.com/redactor/.  
> **username_2**: @BradBell forgot the at-mention with the previous comment. So now again, did they respond? I just checked and they released 10.1.2 in the meantime, but the bug's still not fixed. :(  
> **username_1**: @username_2 - Oops. Forgot to update with their response, which I don't really agree with. `"For code streamlining purposes and to implement more of best practices and to improve compatibility, Redactor doesn't allow inline styling of headings (starting with version 10); please, advise your client to use CSS instead, whenever possible."`  
> **username_1**: @username_2 So essentially "Bug Status: Closed Won't Fix".  
> **username_2**: @BradBell WHAT?? This isn't true.  
> **username_2**: Do they mention any references for their "best practices"?  
> **username_1**: @username_2 Nope... makes no sense to me, either.  
> **username_0**: @BradBell Not to belabor the issue, but how is a client end-user supposed to achieve the desired result "use[ing] CSS instead"? My question is how can a portion of a heading be emphasized or bolded? The only way to target words within a tag is by placing another tag inside said heading, which is what they won't support.  
> **username_3**: I had to edit redactor.js to get this to work, what a joke. Line 4165 comment out: if (this.utils.isCurrentOrParent('PRE') || this.utils.isCurrentOrParentHeader()) return;  
> **username_4**: I received a similar response from Imperavi. It seems like our options are either to toggle code view and add tags manually or to build a custom redactor plugin to handle the desired heading functionality.  
> **username_5**: I'm just starting to get into Craft, and am evaluating its suitability for a site with significant text formatting. From what I've seen, Redactor seems like more of a liability than anything else... it doesn't even have a "Remove Styles" button, FFS. So if you accidentally bold something, good luck unbolding it without diving into the source! What are the chances of Craft switching over to a different, more mature WYSIWYG editor, such as CK Editor?  
> **username_2**: Imperavi released Redactor II 1.0.2 today and *finally* added inline formatting in headings and tables. Please re-open so I can add an answer, thanks! @username_3  
> **username_2**: @BradBell you did not yet abandon Redactor for future Craft releases (2.5, 3.0), did you?  
> **username_1**: @username_2 Nope. Redactor II will be in 2.5.  

---

## 1 answers

### Answer by username_6 on 2015-03-10. Score: 0

Rich Text fields in Craft have several options to them that can affect code output. In your field settings, make sure you don't have `Clean up HTML?` ticked. As the description reads, this option:

> Removes spans, empty tags, and most style attributes on save.

Without seeing your field, this is a wild guess at what could be the problem.

> **Comments:**
> **username_0**: Thanks Jamie, I forgot to mention that the `Clean up HTML?` field is unchecked. I'll add that to my question for clarity.  
> **username_6**: @MichaelThomas Ah, in that case ignore me! :)  
> **username_7**: If you want to get your hack on change line 4295 to if (this.utils.isCurrentOrParent('PRE')) return;  

---

