Skip to content

Commit

Permalink
Merge pull request #6552 from nextcloud/renovate/main-major-highlight
Browse files Browse the repository at this point in the history
fix(deps): update dependency lowlight to v3 (main)
  • Loading branch information
github-actions[bot] authored Nov 26, 2024
2 parents ac5a28f + 5ccc2a9 commit 8cdb7ad
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 99 deletions.
123 changes: 28 additions & 95 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
"escape-html": "^1.0.3",
"highlight.js": "^11.10.0",
"lib0": "^0.2.98",
"lowlight": "^2.9.0",
"lowlight": "^3.2.0",
"markdown-it": "^14.1.0",
"markdown-it-container": "^4.0.0",
"markdown-it-front-matter": "^0.2.4",
Expand Down
6 changes: 4 additions & 2 deletions src/EditorFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@ import MentionSuggestion from './components/Suggestion/Mention/suggestions.js'
import 'proxy-polyfill'

import { Editor } from '@tiptap/core'
import { lowlight } from 'lowlight/lib/core.js'
import { createLowlight } from 'lowlight'
import hljs from 'highlight.js/lib/core'

import { logger } from './helpers/logger.js'
import { FocusTrap, Mention, PlainText, RichText } from './extensions/index.js'
// eslint-disable-next-line import/no-named-as-default
import CodeBlockLowlight from '@tiptap/extension-code-block-lowlight'

const lowlight = createLowlight()

const loadSyntaxHighlight = async (language) => {
const list = hljs.listLanguages()
logger.debug('Supported languages', { list })
Expand All @@ -24,7 +26,7 @@ const loadSyntaxHighlight = async (language) => {
logger.debug('Loading language', language)
// eslint-disable-next-line n/no-missing-import
const syntax = await import(/* webpackChunkName: "highlight/[request]" */`../node_modules/highlight.js/lib/languages/${language}.js`)
lowlight.registerLanguage(language, syntax.default)
lowlight.register(language, syntax.default)
} catch (error) {
// fallback to none
logger.debug('No matching highlighing found', { error })
Expand Down
3 changes: 2 additions & 1 deletion src/extensions/RichText.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

import { Extension } from '@tiptap/core'
import { lowlight } from 'lowlight'
import { createLowlight, common } from 'lowlight'

/* eslint-disable import/no-named-as-default */
import Blockquote from '@tiptap/extension-blockquote'
Expand Down Expand Up @@ -47,6 +47,7 @@ import TrailingNode from './../nodes/TrailingNode.js'
import { Strong, Italic, Strike, Link, Underline } from './../marks/index.js'
import { translate as t } from '@nextcloud/l10n'

const lowlight = createLowlight(common)
lowlight.registerAlias('plaintext', 'mermaid')

export default Extension.create({
Expand Down

0 comments on commit 8cdb7ad

Please sign in to comment.