# Correctly using PrismJS (Syntax Highlighter) for Hubspot Blog posts

**URL:** <https://community.hubspot.com/t/correctly-using-prismjs-syntax-highlighter-for-hubspot-blog-posts/13850>\
**Category:** Blog, Website & Page Publishing\
**Tags:** website-pages, design-tools, content\
**Created:** [April 4, 2019, 3:46pm UTC](https://community.hubspot.com/t/correctly-using-prismjs-syntax-highlighter-for-hubspot-blog-posts/13850 "2019-04-04T15:46:35Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![harroldhino](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/harroldhino/32/51304_2.png) [@harroldhino](https://community.hubspot.com/u/harroldhino)\
**Post date:** [April 4, 2019, 3:46pm UTC](https://community.hubspot.com/t/correctly-using-prismjs-syntax-highlighter-for-hubspot-blog-posts/13850/1 "2019-04-04T15:46:35Z")

</div>

Hello,

I’m looking to improve the readability and aesthetics of out blog.

Being able to use PrismJS would be a muuuch better alternative than hubspot’s inline/table building:

> **[Prism](https://prismjs.com/)**

Does anyone haver experience getting started and using this tool?

---

<div class="post-metadata">

**Author:** ![Bryantworks](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/bryantworks/32/94963_2.png) [@Bryantworks](https://community.hubspot.com/u/Bryantworks)\
**Post date:** [April 5, 2019, 5:16am UTC](https://community.hubspot.com/t/correctly-using-prismjs-syntax-highlighter-for-hubspot-blog-posts/13850/2 "2019-04-05T05:16:01Z")

</div>

Hey @harroldhino

So on your blog layout, you should be able to call the prism.js CDN and then edit the source code for your blogs to correctly use their formatting structure. [This blog post](https://designers.hubspot.com/blog/how-to-insert-source-code-into-your-hubspot-blog-post) talks about the usage of prism.js in HubSpot, so you should be able to!

---

<div class="post-metadata">

**Author:** ![harroldhino](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/harroldhino/32/51304_2.png) [@harroldhino](https://community.hubspot.com/u/harroldhino)\
**Post date:** [April 8, 2019, 11:44am UTC](https://community.hubspot.com/t/correctly-using-prismjs-syntax-highlighter-for-hubspot-blog-posts/13850/3 "2019-04-08T11:44:56Z")

</div>

Thanks for the resposne.

I sw that mention awhile back (it may be how I discovered the tool).

Ultimately I’m limited in my css skills so I was essentially looking for some sort of tuturoial on getting started.

I’ll add another question to the mix: given the above, is it worth the benefits to the user/reader experience to use prism?

A lot a of our content is ‘interactive’ in the sense there is loads of how-to and copy/pasting of code being done.

Thanks!

---

<div class="post-metadata">

**Author:** ![Bryantworks](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/bryantworks/32/94963_2.png) [@Bryantworks](https://community.hubspot.com/u/Bryantworks)\
**Post date:** [April 8, 2019, 12:14pm UTC](https://community.hubspot.com/t/correctly-using-prismjs-syntax-highlighter-for-hubspot-blog-posts/13850/4 "2019-04-08T12:14:46Z")

</div>

Hey @harroldhino

I couldn’t find an A-Z tutorial on prism.js, but I do know that the copy-pasting of code is extremely valuable. I would for sure look into getting it implemented!

---

<div class="post-metadata">

**Author:** ![Bryantworks](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/bryantworks/32/94963_2.png) [@Bryantworks](https://community.hubspot.com/u/Bryantworks)\
**Post date:** [April 9, 2019, 12:10pm UTC](https://community.hubspot.com/t/correctly-using-prismjs-syntax-highlighter-for-hubspot-blog-posts/13850/5 "2019-04-09T12:10:44Z")

</div>

A quick followup to this as it could be useful for others wanting to add [Prism.js](https://prismjs.com/) to their blog or website.

There are several ways to approach it, but to get you started here are the quick steps:

1) Either download prism js and install it in your files on HubSpot or link from a CDN [here](https://cdnjs.com/libraries/prism). The basic files you’ll need are:

- [https://cdnjs.cloudflare.com/ajax/libs/prism/1.16.0/components/prism-core.min.js](https://cdnjs.cloudflare.com/ajax/libs/prism/1.16.0/components/prism-core.min.js)
- [https://cdnjs.cloudflare.com/ajax/libs/prism/1.16.0/themes/prism.min.css](https://cdnjs.cloudflare.com/ajax/libs/prism/1.16.0/themes/prism.min.css)

You can pick a different stylesheet for different highlight colors. You can view them [here](https://prismjs.com/).

2) Include the following URLs (different CSS style if you choose) in either your page template or at the domain level.

Template Level:

 ![Step 1.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/f/0/f0554ae3436574ffd3304c9b76252b088e3f35dc.png)

Domain Level:

 ![Step 2.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/1/0/100f3d2c40eeece3e96e7809d4d8247378ad4454.png)

3) Use the proper Prism classes when displaying code. Prism supports a ton of languages, you just need to specify in the class on the \<code\> class:

\<pre\>\<code class=“ **language-css** ”\>p { color: red }\</code\>\</pre\>

 ![Step 3.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/4/7/47c9af4aaa22913fd44b7bb3a817514ff39be5e8.png)

And there you go! You can check out a sample of Prism in action [here](http://bryantworks-dev-5619734-5619734.hs-sites.com/blog/sample-post?hs_preview=PbTiJGYk-8229337579).

---

<div class="post-metadata">

**Author:** ![harroldhino](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/harroldhino/32/51304_2.png) [@harroldhino](https://community.hubspot.com/u/harroldhino)\
**Post date:** [April 9, 2019, 12:22pm UTC](https://community.hubspot.com/t/correctly-using-prismjs-syntax-highlighter-for-hubspot-blog-posts/13850/6 "2019-04-09T12:22:50Z")

</div>

I’m quite surprised this hasn’t come up before in the past, but @Bryantworks just provided very straightforward options that both work perfectly.

I’ll note that he went above and beyond to directly connect and ensure I got is squared away. He knows his stuff, kudos my friend.

---

<div class="post-metadata">

**Author:** ![Bryantworks](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/bryantworks/32/94963_2.png) [@Bryantworks](https://community.hubspot.com/u/Bryantworks)\
**Post date:** [April 9, 2019, 12:36pm UTC](https://community.hubspot.com/t/correctly-using-prismjs-syntax-highlighter-for-hubspot-blog-posts/13850/7 "2019-04-09T12:36:01Z")

</div>

Thanks @harroldhino! Glad to help out!

---

<div class="post-metadata">

**Author:** ![SSmet](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/ssmet/32/48165_2.png) [@SSmet](https://community.hubspot.com/u/SSmet)\
**Post date:** [February 16, 2022, 1:33pm UTC](https://community.hubspot.com/t/correctly-using-prismjs-syntax-highlighter-for-hubspot-blog-posts/13850/8 "2022-02-16T13:33:05Z")

</div>

I tried this in my hubspot account and it works fine. The only problem that I have is that it puts my code all on one line. Do you maybe know what’s going wrong here?

[http://everythings-25531850.hs-sites-eu1.com/home?hs\_preview=paSoGqjw-46208813304](http://everythings-25531850.hs-sites-eu1.com/home?hs_preview=paSoGqjw-46208813304)
