Richtext - customize b tag into strong tag | Community
Skip to main content
Level 3
August 27, 2021
Solved

Richtext - customize b tag into strong tag

  • August 27, 2021
  • 2 replies
  • 1124 views

Hi community,

 

in aem 6.5, how can i customize bold <b> tag into <strong>?

i have tried with:

<htmlRules jcr:primaryType="nt:unstructured">
<docType jcr:primaryType="nt:unstructured">
<typeConfig jcr:primaryType="nt:unstructured">
<semanticMarkupMap jcr:primaryType="nt:unstructured"
strong="b"/>
</typeConfig>
</docType>
</htmlRules>

but it seems that the replacement is random (not stable). sometime it's work and sometime no. debugging the clientlibs: /libs/clientlibs/granite/richtext.js i saw the "deprecated" word:

and during the 

this.elementsToChange = clear(this.elementsToChange);

the list sometime is 0 and other time is correctly catched!

 

 

What i'm wrong? my suspect is related to the "<strong>" tag acceptance.. seems that from this customization the tag is replaced and from another side, the tag is converted againt into <b>.

 

tks,

 

 

 

 

 

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Asutosh_Jena_

Hi @davidef34326447 

 

Did you try adding the below code? It works perfectly fine for me on AEM 6.5.9.0. It works in any AEM 6.5 version as I am using it from 6.5.3.0 onwards.

 

<htmlRules jcr:primaryType="nt:unstructured">
<docType jcr:primaryType="nt:unstructured">
<typeConfig
jcr:primaryType="nt:unstructured"
isXhtmlStrict="{Boolean}true"
useSemanticMarkup="{Boolean}true"/>
</docType>
</htmlRules>

 

Thanks! 

2 replies

Asutosh_Jena_
Community Advisor
Asutosh_Jena_Community AdvisorAccepted solution
Community Advisor
August 27, 2021

Hi @davidef34326447 

 

Did you try adding the below code? It works perfectly fine for me on AEM 6.5.9.0. It works in any AEM 6.5 version as I am using it from 6.5.3.0 onwards.

 

<htmlRules jcr:primaryType="nt:unstructured">
<docType jcr:primaryType="nt:unstructured">
<typeConfig
jcr:primaryType="nt:unstructured"
isXhtmlStrict="{Boolean}true"
useSemanticMarkup="{Boolean}true"/>
</docType>
</htmlRules>

 

Thanks! 

Vijayalakshmi_S
Level 10
August 27, 2021

Hi @davidef34326447,

The culprit is markup map node which says to map strong as b(strong="b") instead of b to strong(b="strong")

You can update the typeConfig node as @asutosh_jena_ mentioned and remove the semanticmarkupMap node