feat: dynamic highlight.js language import #952

Closed
dpschen wants to merge 1 commits from dpschen/frontend:feature/feat-dynamic-hightlighjs-lang-import into main
Member
No description provided.
konrad approved these changes 2021-11-09 19:06:14 +00:00
konrad left a comment
Owner

Looks fine to me, any reason this is still wip?

Looks fine to me, any reason this is still wip?
dpschen changed title from WIP: feat: dynamic highlight.js language import to feat: dynamic highlight.js language import 2021-11-09 21:48:09 +00:00
Author
Member

If it works its fine :)

If it works its fine :)
konrad requested changes 2021-11-09 22:40:38 +00:00
konrad left a comment
Owner

Sadly, it looks like this does not work like it should. My guess is that marked does not like using async functions for options.

Sadly, it looks like this does not work like it should. My guess is that marked does not like using async functions for options.
Author
Member

@konrad: It should support it: https://marked.js.org/using_advanced#highlight

But I guess something else doesn't work then =)
Will check.

@konrad: It _should_ support it: https://marked.js.org/using_advanced#highlight But I guess something else doesn't work then =) Will check.
dpschen force-pushed feature/feat-dynamic-hightlighjs-lang-import from d9c5cb4b83 to 41c710a9ca 2021-11-11 01:41:09 +00:00 Compare
dpschen reviewed 2021-11-11 01:41:49 +00:00
@ -48,3 +48,2 @@
import DOMPurify from 'dompurify'
import hljs from 'highlight.js/lib/common'
const hljsImport = () => import('highlight.js/lib/core').then(({hljs}) => hljs)
Author
Member

I changed this line. Maybe it works now =)

I changed this line. Maybe it works now =)
Author
Member

Resolving this comment since it seams that this wasn't the issue.

Resolving this comment since it seams that this wasn't the issue.
dpschen marked this conversation as resolved
Owner

Looks like it still has issues:

image

Looks like it still has issues: ![image](/attachments/1103c064-6072-4b0b-918e-8a53ed77419c)
174 KiB
Author
Member

That sucks: https://github.com/vitejs/vite/issues/1903
Looks like vite doesn't support dynamic importing of dependency modules.
I was so sure that this would work that I didn't even consider this at first :/

I then manually imported everything, but got another error by marked…

Closing, since we want to replace the editor either way.

That sucks: https://github.com/vitejs/vite/issues/1903 Looks like vite doesn't support dynamic importing of dependency modules. I was so sure that this would work that I didn't even consider this at first :/ I then manually imported everything, but got another error by marked… Closing, since we want to replace the editor either way.
dpschen closed this pull request 2021-11-13 18:13:53 +00:00
This repo is archived. You cannot comment on pull requests.
No description provided.