Skip to content

feature: show language name above code blocks without icons #376

@ckjoris

Description

@ckjoris

Neovim version (nvim -v)

0.10.2

Neovim distribution

n/a

Operating system

linux

Terminal emulator / GUI

guake

Describe the bug

the language name is not visible on top of markdown code blocks, for some languages,
like: 'racket', 'as3', or 'custom'. Its not fixed even if I set code = { enabled = false } in the config.atleast

Image

Image

test.md

Expected behavior

even if language is a rare or custom name, it should show the name.

Healthcheck output

==============================================================================
render-markdown: require("render-markdown.health").check()

render-markdown.nvim [version] ~
- OK plugin 8.1.8
- OK neovim >= 0.10

render-markdown.nvim [configuration] ~
- OK valid

render-markdown.nvim [treesitter] ~
- OK markdown: parser installed
- OK markdown_inline: parser installed
- OK latex: parser installed
- OK html: parser installed
- OK markdown: highlight enabled

render-markdown.nvim [icons] ~
- OK using: nvim-web-devicons

render-markdown.nvim [executables] ~
- OK latex2text: not installed

render-markdown.nvim [conflicts] ~
- OK headlines: not installed
- OK markview: not installed
- OK obsidian: not installed

Plugin configuration

require("render-markdown").setup({
						overrides = {
							buftype = {
								nofile = { enabled = false },
							},
						},
						latex = { enabled = false },
						code = {
							-- Turn on / off code block & inline code rendering.
							enabled = true,
							-- style = 'none',
							style = "full",
							width = "block",
							-- left_pad = 0.2,
							right_pad = 0.2,
							min_width = 60,
							-- language_pad = 2,
							-- Whether to include the language name next to the icon.
							language_name = true,
							-- highlight_language = nil,
							sign = false
						},
						pipe_table = {
							-- Turn on / off pipe table rendering.
							enabled = true,
						},
						-- Checkboxes are a special instance of a 'list_item' that start with a 'shortcut_link'.
						-- There are two special states for unchecked & checked defined in the markdown grammar.
						checkbox = {
							-- Turn on / off checkbox state rendering.
							enabled = true,
							-- Additional modes to render checkboxes.
							render_modes = false,
							-- Determines how icons fill the available space.
							-- | inline  | underlying text is concealed resulting in a left aligned icon |
							-- | overlay | result is left padded with spaces to hide any additional text |
							position = "inline",
							unchecked = {
								-- Replaces '[ ]' of 'task_list_marker_unchecked'.
								icon = "󰄱 ",
								-- Highlight for the unchecked icon.
								highlight = "RenderMarkdownTodo", -- make it gray
								-- Highlight for item associated with unchecked checkbox.
								scope_highlight = nil,
							},
							checked = {
								-- Replaces '[x]' of 'task_list_marker_checked'.
								icon = "󰱒 ",
								highlight = "RenderMarkdownTodo", -- make it gray
								scope_highlight = nil,
							},
							-- Define custom checkbox states, more involved, not part of the markdown grammar.
							-- As a result this requires neovim >= 0.10.0 since it relies on 'inline' extmarks.
							-- The key is for healthcheck and to allow users to change its values, value type below.
							-- | raw             | matched against the raw text of a 'shortcut_link'           |
							-- | rendered        | replaces the 'raw' value when rendering                     |
							-- | highlight       | highlight for the 'rendered' icon                           |
							-- | scope_highlight | optional highlight for item associated with custom checkbox |
							custom = {
								todo = {
									raw = "[-]",
									rendered = "󰥔 ",
									highlight = "RenderMarkdownTodo",
									scope_highlight = nil,
								},
							},
						},
					})

Plugin error log

N/A

Confirmations

  • I have updated this plugin to the latest version using my plugin manager
  • I have provided the text contained in all screenshots as raw text in this issue. This means if there is a screenshot below it is the copy pasted contents of the file in the screenshot. I understand that my issue will be closed if I have not.

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions