Title: Highligh Javascript code inside HTML
Last modified: May 23, 2020

---

# Highligh Javascript code inside HTML

 *  Resolved [Spacetime](https://wordpress.org/support/users/spacetime/)
 * (@spacetime)
 * [6 years ago](https://wordpress.org/support/topic/highligh-javascript-code-inside-html/)
 * Hello,
 * can you please explain how to highlight Javsacript code inside HTML code, for
   example:
 *     ```
       <script type="text/javascript">
         amzn_assoc_placement = "adunit0";
         amzn_assoc_search_bar = "true";
       </script>
       <script src="//z-na.amazon-adsystem.com/widgets/onejs?MarketPlace=US"></script>
       ```
   
 * Also the equal sign in the last script src tag is highlighted as punctuation 
   even it is part of the string (atribute value).
 * Second question: how can you change the language of a code block?

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Plugin Author [Jeff Starr](https://wordpress.org/support/users/specialk/)
 * (@specialk)
 * [6 years ago](https://wordpress.org/support/topic/highligh-javascript-code-inside-html/#post-12880998)
 * Hello,
 * Here are instructions for implementing line highlight with Prism.js:
 * [https://prismjs.com/plugins/line-highlight/](https://prismjs.com/plugins/line-highlight/)
 * “Second question: how can you change the language of a code block?”
 * It depends, how are you adding the code blocks to begin with?
 *  Thread Starter [Spacetime](https://wordpress.org/support/users/spacetime/)
 * (@spacetime)
 * [6 years ago](https://wordpress.org/support/topic/highligh-javascript-code-inside-html/#post-12881018)
 * 1. Misunderstanding.
 * I only need to syntax highlight Javascript code (inside HTML) as Javascript –
   now it is shown with default `language-markup` color.
 * 2. I’m using the classic editor and I click on the `<>` button to add Prism.js
   code. I’m asked for the language but when the code is there I don’t know how 
   to change it (except by editing source code).
 * 3. I fixed punctuations in atribute values with CSS rules.
 *  Plugin Author [Jeff Starr](https://wordpress.org/support/users/specialk/)
 * (@specialk)
 * [6 years ago](https://wordpress.org/support/topic/highligh-javascript-code-inside-html/#post-12881036)
 * 1) Can you provide steps or something, having a hard time trying to understand
   how to help here.
 * 2) Yeah you need to edit the source code. Check out the detailed instructions
   here:
 * [https://wordpress.org/plugins/prismatic/#installation](https://wordpress.org/plugins/prismatic/#installation)
 * Basically just change `language-php` to `language-whatever` and save changes.
   Lots of details in the above linked docs, recommended.
 * 3) Okay.
 *  Thread Starter [Spacetime](https://wordpress.org/support/users/spacetime/)
 * (@spacetime)
 * [6 years ago](https://wordpress.org/support/topic/highligh-javascript-code-inside-html/#post-12881065)
 * This is part of HTML code:
 *     ```
       <div class="ai-form warning-enabled rounded">
         <div style="clear: both;"></div>
       </div>
       <script type="text/javascript">
         amzn_assoc_placement = "adunit0";
         amzn_assoc_search_bar = "true";
       </script>
       <script src="//z-na.amazon-adsystem.com/widgets/onejs?MarketPlace=US"></script>
       ```
   
 * I select HTML as the language and it works fine for HTML. However, Javascript
   code inside `<script>` tags is shown with the default `language-markup` color.
 * I would like to use colors for Javascript language there.
 *  Plugin Author [Jeff Starr](https://wordpress.org/support/users/specialk/)
 * (@specialk)
 * [6 years ago](https://wordpress.org/support/topic/highligh-javascript-code-inside-html/#post-12881115)
 * Yeah that happens when multiple languages are included in the same code block.
   It’s an issue that needs to be dealt with by the providers of the syntax-highlight
   scripts (i.e., Prism.js and Highlight.js). For example, I often share code that
   contains both HTML and PHP at my code snippets site [WP-Mix](https://wp-mix.com/).
   And the result most of the time is that the syntax-highlighting breaks at some
   point in the code block. Not sure if there is anything that can be done other
   than report to Prism.js devs.
    -  This reply was modified 6 years ago by [Jeff Starr](https://wordpress.org/support/users/specialk/).
      Reason: Adds infos
 *  Thread Starter [Spacetime](https://wordpress.org/support/users/spacetime/)
 * (@spacetime)
 * [6 years ago](https://wordpress.org/support/topic/highligh-javascript-code-inside-html/#post-12881213)
 * I fixed the issue with additional code tags with javascript class.
 * Thansk for the answers.
 *  Plugin Author [Jeff Starr](https://wordpress.org/support/users/specialk/)
 * (@specialk)
 * [6 years ago](https://wordpress.org/support/topic/highligh-javascript-code-inside-html/#post-12881257)
 * You’re wlecome. Glad you got it sorted.

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Highligh Javascript code inside HTML’ is closed to new replies.

 * ![](https://ps.w.org/prismatic/assets/icon-256x256.png?rev=1521267)
 * [Prismatic](https://wordpress.org/plugins/prismatic/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/prismatic/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/prismatic/)
 * [Active Topics](https://wordpress.org/support/plugin/prismatic/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/prismatic/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/prismatic/reviews/)

## Tags

 * [highlighting](https://wordpress.org/support/topic-tag/highlighting/)
 * [html](https://wordpress.org/support/topic-tag/html/)
 * [javascript](https://wordpress.org/support/topic-tag/javascript/)

 * 7 replies
 * 2 participants
 * Last reply from: [Jeff Starr](https://wordpress.org/support/users/specialk/)
 * Last activity: [6 years ago](https://wordpress.org/support/topic/highligh-javascript-code-inside-html/#post-12881257)
 * Status: resolved