Skip to content

Hongdown config for nvimtools/none-ls.nvim #4

@vavakado

Description

@vavakado

I don't really know where to put this, so I'm gonna put it here. Perhaps I should make a pull request to none-ls.nvim so they have it as a built-in, but I'm not sure.

local hongdown = {
    name = 'hongdown',
    method = null_ls.methods.FORMATTING,
    filetypes = {
        'markdown',
    },
    generator = null_ls.generator({
        command = 'hongdown',
        args = {
            '--stdin',
        },
        to_stdin = true,
        from_stderr = false,
        format = 'raw',
        check_exit_code = function(code, stderr)
            local success = code <= 1

            if not success then
                print(stderr)
            end

            return success
        end,
        on_output = function(params, done)
            local output = params.output
            if not output then
                return done()
            end

            return done({ { text = output } })
        end,
    }),
}

null_ls.register(hongdown)

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions