steven-tey / novel

Notion-style WYSIWYG editor with AI-powered autocompletion.
https://novel.sh
Apache License 2.0
13.22k stars 1.08k forks source link

feat: Added support for code blocks syntax highlighting #375

Closed ankuragrwl closed 6 months ago

ankuragrwl commented 7 months ago

I have added the support for code syntax highlighting in code-blocks.

Following changes were included:

Added @tiptap/extension-code-block-lowlight to headless package. No styling added here to keep it headless.

Enhanced the web application and added css styles to globals.css. Configured the lowlight using highlight languages in extensions.ts.

const lowlight = createLowlight(common); lowlight.register("html", html); lowlight.register("css", css); lowlight.register("js", js); lowlight.register("ts", ts);

const codeBlockLowlight = CodeBlockLowlight.configure({ lowlight, });

vercel[bot] commented 7 months ago

@ankuragrwl is attempting to deploy a commit to the Dub Team on Vercel.

A member of the Team first needs to authorize it.

socket-security[bot] commented 7 months ago

New and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/@radix-ui/react-dropdown-menu@2.0.6 Transitive: environment +41 2.26 MB benoitgrelard
npm/@tailwindcss/typography@0.5.12 None +6 381 kB adamwathan
npm/@tiptap/extension-code-block-lowlight@2.2.6 None +1 774 kB _bdbch
npm/@types/node@20.12.7 None +1 2.1 MB types
npm/@types/react-dom@18.2.25 None 0 34.9 kB types
npm/@types/react@18.2.77 None +2 1.69 MB types
npm/autoprefixer@10.4.19 environment Transitive: filesystem, shell +10 2.77 MB ai
npm/clsx@2.1.0 None 0 8.46 kB lukeed
npm/eslint-config-next@14.1.4 unsafe Transitive: environment, eval, filesystem, shell +207 18.2 MB vercel-release-bot
npm/eslint@8.57.0 environment, filesystem Transitive: eval, shell, unsafe +97 10.7 MB eslintbot
npm/lucide-react@0.363.0 None 0 22.6 MB ericfennis
npm/next-themes@0.3.0 None 0 18.2 kB paco
npm/next@14.1.4 environment, filesystem, network, shell, unsafe +18 1.11 GB vercel-release-bot
npm/novel@0.2.13 Transitive: environment, filesystem +198 29.6 MB andrewdoro
npm/sonner@1.4.41 None 0 447 kB emilkowalski
npm/tailwind-merge@2.2.2 None +2 989 kB dcas
npm/tailwindcss@3.4.3 environment, filesystem Transitive: network, shell, unsafe +102 14.4 MB adamwathan
npm/typescript@5.4.5 None 0 32.4 MB typescript-bot

🚮 Removed packages: npm/eslint-config-next@13.2.4, npm/eslint@8.36.0, npm/eventsource-parser@0.1.0, npm/jotai@2.6.4, npm/lucide-react@0.244.0, npm/next-themes@0.2.1, npm/next@14.1.0, npm/novel@0.3.1, npm/openai@4.28.0, npm/postcss@8.4.35, npm/prettier-plugin-tailwindcss@0.3.0, npm/prettier@2.8.8, npm/sonner@0.7.4, npm/tailwind-merge@1.14.0, npm/tailwindcss@3.4.1, npm/tiptap-extension-auto-joiner@0.1.1, npm/tiptap-extension-global-drag-handle@0.1.6, npm/tiptap-markdown@0.8.9, npm/ts-pattern@5.0.6, npm/tsup@8.0.2, npm/turbo@1.12.3, npm/typescript@5.3.3, npm/use-debounce@9.0.4

View full report↗︎

maks-ivanov commented 7 months ago

When I was looking into this feature, I found some weird highlight.js bugs with streaming, so worth testing that

ankuragrwl commented 7 months ago

When I was looking into this feature, I found some weird highlight.js bugs with streaming, so worth testing that

Removed usage of highlight.js as defaut configuration already supports 37 most common languages