U
U
uRoot2022-04-04 15:51:16
Vue.js
uRoot, 2022-04-04 15:51:16

How to make friends in Vue Tinymce with Prism?

When you add code in the editor via codesample or when you edit an article with code inside, everything is displayed as needed. And when you open the article itself, the code is not highlighted.

How it looks on the page
624aea66affb2217079803.png

How it looks in the editor
624ae99d67216040727967.png

I output the text of the article itself like this: Any ideas? <div class="article__text" v-html="list.text"/>

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander, 2022-04-04
@Aleksandr-JS-Developer

Recently played played with a similar moment.
Most likely, the styles just didn't connect.
Import editor styles with separate style and without scoped attribute

U
uRoot, 2022-04-07
@uroot

Everything turned out to be much easier.
Install the most common version of prism : https://www.npmjs.com/package/prismjs

import Prism from "prismjs"
import 'prismjs/themes/prism.css'

and call in our article:
Prism.highlightAll()
Everything works as it should

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question