From ba413282677e1027a42d6ff585115d3e1df12b66 Mon Sep 17 00:00:00 2001 From: Omar Valdez Date: Fri, 2 Aug 2024 15:49:20 -0700 Subject: [PATCH] feat: Add markdown.nvim integration (#740) * feat: Add markdown.nvim integration * fix: option order * fix: Use `render-markdown` name in README --- README.md | 14 ++++++++++ .../groups/integrations/render_markdown.lua | 27 +++++++++++++++++++ lua/catppuccin/init.lua | 1 + lua/catppuccin/types.lua | 1 + 4 files changed, 43 insertions(+) create mode 100644 lua/catppuccin/groups/integrations/render_markdown.lua diff --git a/README.md b/README.md index 5965d582..f6c7f9a7 100644 --- a/README.md +++ b/README.md @@ -1326,6 +1326,20 @@ To use another flavour just replace `mocha` with the one you want to use. + + + + render-markdown (markdown.nvim) + + +```lua +render_markdown = true +``` + + + + + diff --git a/lua/catppuccin/groups/integrations/render_markdown.lua b/lua/catppuccin/groups/integrations/render_markdown.lua new file mode 100644 index 00000000..8b2f1b5f --- /dev/null +++ b/lua/catppuccin/groups/integrations/render_markdown.lua @@ -0,0 +1,27 @@ +local M = {} + +-- markdown.nvim highlight groups: +-- https://github.com/MeanderingProgrammer/markdown.nvim?tab=readme-ov-file#colors + +function M.get() + local groups = { + RenderMarkdownCode = { bg = C.surface0 }, + RenderMarkdownCodeInline = { bg = C.surface1 }, + RenderMarkdownBullet = { fg = C.sky }, + RenderMarkdownTableHead = { fg = C.blue }, + RenderMarkdownTableRow = { fg = C.lavender }, + } + + local syntax = require("catppuccin.groups.syntax").get() + local base = not O.transparent_background and C.base or nil + + for i = 1, 6 do + local color = syntax["rainbow" .. i].fg + groups["RenderMarkdownH" .. i] = { fg = color } + groups["RenderMarkdownH" .. i .. "Bg"] = { bg = U.darken(color, 0.30, base) } + end + + return groups +end + +return M diff --git a/lua/catppuccin/init.lua b/lua/catppuccin/init.lua index 5946f559..ce0d577b 100644 --- a/lua/catppuccin/init.lua +++ b/lua/catppuccin/init.lua @@ -52,6 +52,7 @@ local M = { nvimtree = true, ufo = true, rainbow_delimiters = true, + render_markdown = true, semantic_tokens = not is_vim, telescope = { enabled = true }, treesitter = not is_vim, diff --git a/lua/catppuccin/types.lua b/lua/catppuccin/types.lua index 8ccc492c..4c5aff90 100644 --- a/lua/catppuccin/types.lua +++ b/lua/catppuccin/types.lua @@ -192,6 +192,7 @@ ---@field overseer boolean? ---@field pounce boolean? ---@field rainbow_delimiters boolean? +---@field render_markdown boolean? ---@field sandwich boolean? ---@field semantic_tokens boolean? ---@field symbols_outline boolean?