Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

feature: codeblocks should have a true left margin

未关闭
#656 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 6 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
48/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
冷清
技术栈
lua, neovim
领域
tooling

调研方向

从插件的代码配置入手,尤其是现有的 left_margin、left_pad、background_inset 和 width 选项,并比较标题缩进的呈现方式。完成标准是:代码块可以通过可配置的边距向右移动,同时背景覆盖该边距而不影响缩进线。

由索引模型根据 Issue 内容生成。

描述

enhancement
Is your feature request related to a problem? Please describe.

margin for other elements like headings, bullets etc is true margin i.e. the cursor cannot enter that area in normal mode. codeblocks should also have a similar margin, this would improve their appearance a lot.

Image

something like this. i have added 2 spaces before ach line of code, but that doesn't work well as the indentation lines show up on the left side. the actual codeblock markers start from that indentation line..

Image

but if instead we can move the entire codeblock right by 2 spaces and highlight those two spaces with code block color, it would improve the appearance of the code block and also not mess up with the indentation lines.

Describe the solution you'd like

the solution would be to add an option "block_margin" or something similar which would work similar to heading indentations but the codeblock will still be rendered (the background) on those margin spaces...

Describe alternatives you've considered

alternative is to just be happy in what you have :)

Additional information

my plugin config

return {
  "MeanderingProgrammer/render-markdown.nvim",
  config = function()
    require("render-markdown").setup({
      render_modes = true,
      anti_conceal = {
        enabled = true,
        disabled_modes = false,
        above = 0,
        below = 0,
        ignore = {
          code_background = true,
          indent = true,
          sign = true,
          virtual_lines = true,
        },
      },
      link = {
        enabled = true,
        render_modes = false,
        footnote = {
          enabled = true,
          icon = "󰯔 ",
          body = function(ctx)
            return ctx.text
          end,
          superscript = true,
          prefix = "",
          suffix = "",
        },
        image = "󰥶 ",
        image_custom = true,
        email = "󰀓 ",
        hyperlink = "󰌹 ",
        highlight = "RenderMarkdownLink",
        highlight_title = "RenderMarkdownLinkTitle",
        wiki = {
          enabled = true,
          icon = "󱗖 ",
          conceal_destination = true,
          body = function()
            return nil
          end,
          highlight = "RenderMarkdownWikiLink",
          scope_highlight = nil,
        },
        custom = {
          web = { icon = "󰖟 ", pattern = "^http" },
          apple = { icon = " ", pattern = "apple%.com", kind = "url" },
          discord = { icon = "󰙯 ", pattern = "discord%.com", kind = "url" },
          github = { icon = "󰊤 ", pattern = "github%.com", kind = "url" },
          gitlab = { icon = "󰮠 ", pattern = "gitlab%.com", kind = "url" },
          google = { icon = "󰊭 ", pattern = "google%.com", kind = "url" },
          hackernews = { icon = " ", pattern = "ycombinator%.com", kind = "url" },
          linkedin = { icon = "󰌻 ", pattern = "linkedin%.com", kind = "url" },
          microsoft = { icon = " ", pattern = "microsoft%.com", kind = "url" },
          neovim = { icon = " ", pattern = "neovim%.io", kind = "url" },
          reddit = { icon = "󰑍 ", pattern = "reddit%.com", kind = "url" },
          slack = { icon = "󰒱 ", pattern = "slack%.com", kind = "url" },
          stackoverflow = { icon = "󰓌 ", pattern = "stackoverflow%.com", kind = "url" },
          steam = { icon = " ", pattern = "steampowered%.com", kind = "url" },
          twitter = { icon = " ", pattern = "twitter%.com", kind = "url" },
          wikipedia = { icon = "󰖬 ", pattern = "wikipedia%.org", kind = "url" },
          x = { icon = " ", pattern = "x%.com", kind = "url" },
          youtube = { icon = "󰗃 ", pattern = "youtube[^.]*%.com", kind = "url" },
          youtube_short = { icon = "󰗃 ", pattern = "youtu%.be", kind = "url" },
        },
      },
      bullet = {
        enabled = true,
        render_modes = false,
        icons = { "•", "•", "•", "•" },
        ordered_icons = function(ctx)
          local value = vim.trim(ctx.value)
          local index = tonumber(value:sub(1, #value - 1))
          return ("%d."):format(index > 1 and index or ctx.index)
        end,
        left_pad = 0,
        right_pad = 0,
        highlight = "RenderMarkdownBullet",
        scope_highlight = {},
        scope_priority = nil,
      },
      quote = {
        enabled = true,
        render_modes = false,
        icon = "▋",
        repeat_linebreak = false,
        highlight = {
          "RenderMarkdownQuote1",
          "RenderMarkdownQuote2",
          "RenderMarkdownQuote3",
          "RenderMarkdownQuote4",
          "RenderMarkdownQuote5",
          "RenderMarkdownQuote6",
        },
      },
      callout = {
        note = {
          raw = "[!NOTE]",
          rendered = "󰋽  Note",
          highlight = "RenderMarkdownInfo",
          category = "github",
        },
        tip = {
          raw = "[!TIP]",
          rendered = "󰌶 Tip",
          highlight = "RenderMarkdownSuccess",
          category = "github",
        },
        important = {
          raw = "[!IMPORTANT]",
          rendered = "󰅾  Important",
          highlight = "RenderMarkdownHint",
          category = "github",
        },
        warning = {
          raw = "[!WARNING]",
          rendered = "󰀪  Warning",
          highlight = "RenderMarkdownWarn",
          category = "github",
        },
        caution = {
          raw = "[!CAUTION]",
          rendered = "󰳦  Caution",
          highlight = "RenderMarkdownError",
          category = "github",
        },
        abstract = {
          raw = "[!ABSTRACT]",
          rendered = "󰨸  Abstract",
          highlight = "RenderMarkdownInfo",
          category = "obsidian",
        },
        summary = {
          raw = "[!SUMMARY]",
          rendered = "󰨸  Summary",
          highlight = "RenderMarkdownInfo",
          category = "obsidian",
        },
        tldr = {
          raw = "[!TLDR]",
          rendered = "󰨸  TL;DR",
          highlight = "RenderMarkdownInfo",
          category = "obsidian",
        },
        info = {
          raw = "[!INFO]",
          rendered = "󰋽  Info",
          highlight = "RenderMarkdownInfo",
          category = "obsidian",
        },
        todo = {
          raw = "[!TODO]",
          rendered = "󰗡  Todo",
          highlight = "RenderMarkdownInfo",
          category = "obsidian",
        },
        hint = {
          raw = "[!HINT]",
          rendered = "󰌶 Hint",
          highlight = "RenderMarkdownSuccess",
          category = "obsidian",
        },
        success = {
          raw = "[!SUCCESS]",
          rendered = "󰄬  Success",
          highlight = "RenderMarkdownSuccess",
          category = "obsidian",
        },
        check = {
          raw = "[!CHECK]",
          rendered = "󰄬  Check",
          highlight = "RenderMarkdownSuccess",
          category = "obsidian",
        },
        done = {
          raw = "[!DONE]",
          rendered = "󰄬  Done",
          highlight = "RenderMarkdownSuccess",
          category = "obsidian",
        },
        question = {
          raw = "[!QUESTION]",
          rendered = "󰘥  Question",
          highlight = "RenderMarkdownWarn",
          category = "obsidian",
        },
        help = {
          raw = "[!HELP]",
          rendered = "󰘥  Help",
          highlight = "RenderMarkdownWarn",
          category = "obsidian",
        },
        faq = {
          raw = "[!FAQ]",
          rendered = "󰘥  Faq",
          highlight = "RenderMarkdownWarn",
          category = "obsidian",
        },
        attention = {
          raw = "[!ATTENTION]",
          rendered = "󰀪  Attention",
          highlight = "RenderMarkdownWarn",
          category = "obsidian",
        },
        failure = {
          raw = "[!FAILURE]",
          rendered = "󰅖 Failure",
          highlight = "RenderMarkdownError",
          category = "obsidian",
        },
        fail = {
          raw = "[!FAIL]",
          rendered = "󰅖 Fail",
          highlight = "RenderMarkdownError",
          category = "obsidian",
        },
        missing = {
          raw = "[!MISSING]",
          rendered = "󰅖 Missing",
          highlight = "RenderMarkdownError",
          category = "obsidian",
        },
        danger = {
          raw = "[!DANGER]",
          rendered = "󱐌 Danger",
          highlight = "RenderMarkdownError",
          category = "obsidian",
        },
        error = {
          raw = "[!ERROR]",
          rendered = "󱐌 Error",
          highlight = "RenderMarkdownError",
          category = "obsidian",
        },
        bug = {
          raw = "[!BUG]",
          rendered = "󰨰 Bug",
          highlight = "RenderMarkdownError",
          category = "obsidian",
        },
        example = {
          raw = "[!EXAMPLE]",
          rendered = "󰉹  Example",
          highlight = "RenderMarkdownHint",
          category = "obsidian",
        },
        quote = {
          raw = "[!QUOTE]",
          rendered = "󱆨  Quote",
          highlight = "RenderMarkdownQuote",
          category = "obsidian",
        },
        cite = {
          raw = "[!CITE]",
          rendered = "󱆨  Cite",
          highlight = "RenderMarkdownQuote",
          category = "obsidian",
        },
      },
      checkbox = {
        enabled = false,
        render_modes = false,
        bullet = false,
        left_pad = 0,
        right_pad = 1,
        unchecked = {
          icon = "󰄱 ",
          highlight = "RenderMarkdownUnchecked",
          scope_highlight = nil,
        },
        checked = {
          icon = "󰱒 ",
          highlight = "RenderMarkdownChecked",
          scope_highlight = nil,
        },
        custom = {
          todo = { raw = "[-]", rendered = "󰥔 ", highlight = "RenderMarkdownTodo", scope_highlight = nil },
        },
        scope_priority = nil,
      },
      code = {
        enabled = true,
        render_modes = true,
        sign = false,
        conceal_delimiters = false,
        language = true,
        position = "left",
        language_icon = false,
        language_name = false,
        language_info = false,
        language_pad = 0,
        disable = {},
        disable_background = { "diff" },
        background_inset = 1,
        width = "block",
        left_margin = 0,
        left_pad = 0,
        right_pad = 0,
        min_width = 90,
        border = "thin",
        language_border = "█",
        language_left = "",
        language_right = "",
        above = "▄",
        below = "▀",
        inline = true,
        inline_left = "",
        inline_right = "",
        inline_pad = 0,
        priority = 140,
        highlight = "RenderMarkdownCode",
        highlight_info = "RenderMarkdownCodeInfo",
        highlight_language = nil,
        highlight_border = "RenderMarkdownCodeBorder",
        highlight_fallback = "RenderMarkdownCodeFallback",
        highlight_inline = "RenderMarkdownCodeInline",
        highlight_inline_left = nil,
        highlight_inline_right = nil,
        style = "full",
      },
      dash = {
        enabled = true,
        render_modes = false,
        icon = "─",
        width = "full",
        left_margin = 0,
        priority = nil,
        highlight = "RenderMarkdownDash",
      },
      indent = {
        enabled = true,
        render_modes = true,
        per_level = 1,
        skip_level = 1,
        skip_heading = false,
        icon = " ",
        priority = 0,
        highlight = "RenderMarkdownIndent",
      },
      paragraph = {
        enabled = true,
        render_modes = false,
        left_margin = 0,
        indent = 0,
        min_width = 0,
      },
      heading = {
        enabled = true,
        render_modes = false,
        atx = true,
        setext = true,
        sign = false,
        -- icons = { "◉  ", "○  ", "✸  ", "✿  ", "✿  ", "✿  " },
        icons = { "# ", "## ", "### ", "#### ", "##### ", "###### " },
        position = "overlay",
        signs = { "󰫎 " },
        width = "full",
        left_margin = 0,
        left_pad = 0,
        right_pad = 0,
        min_width = 0,
        border = false,
        border_virtual = false,
        border_prefix = false,
        above = "▄",
        below = "▀",
        backgrounds = {
          "RenderMarkdownH1Bg",
          "RenderMarkdownH2Bg",
          "RenderMarkdownH3Bg",
          "RenderMarkdownH4Bg",
          "RenderMarkdownH5Bg",
          "RenderMarkdownH6Bg",
        },
        foregrounds = {
          "RenderMarkdownH1",
          "RenderMarkdownH2",
          "RenderMarkdownH3",
          "RenderMarkdownH4",
          "RenderMarkdownH5",
          "RenderMarkdownH6",
        },
        custom = {},
      },
      pipe_table = {
        enabled = true,
        render_modes = true,
        preset = "none",
        cell = "padded",
        cell_offset = function()
          return 0
        end,
        padding = 1,
        min_width = 0,
        border = {
          "┌",
          "┬",
          "┐",
          "├",
          "┼",
          "┤",
          "└",
          "┴",
          "┘",
          "│",
          "─",
        },
        border_enabled = false,
        border_virtual = false,
        alignment_indicator = "━",
        head = "RenderMarkdownTableHead",
        row = "RenderMarkdownTableRow",
        style = "full",
      },
      completions = {
        lsp = { enabled = true },
      },
    })
  end,
}
主要语言
Lua
星标
5.2k
派生
145
PR 合并指标
30 天内没有已合并 PR

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

MeanderingProgrammer/render-markdown.nvim 的其他 Issue

查看 MeanderingProgrammer/render-markdown.nvim 的全部 Issue

相似的 Issue

更多 Lua Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。