Skip to content

Feature: Adding support for custom @tags #3314

@JoshPiper

Description

@JoshPiper

One of the nice things with LDoc was the ability to define custom tags, so they could be used to give additional annotations.

As an example, this is the tags section of one of our projects.

custom_tags = {
	{"baseclass", title = "BaseClass", hidden = true},
	{"state", title = "State", hidden = true},

	{"warns", title = "Warnings", format = function(...)
		return "<span class='tag-warning'>" .. markup(...) .. "</span>"
	end},
	{"bugs", title = "Known Issues", format = function(...)
		return "<span class='tag-bugs'>" .. markup(...) .. "</span>"
	end},
	{"deprecated", title = "Deprecated", format = function(str)
		if str == "" then
			return "<span class='tag-deprecated'>This function is deprecated and may be removed in a future version.</span>"
		else
			return "<span class='tag-deprecated'>This function is deprecated and may be removed in a future version.<br>" .. markup(str) .. "</span>"
		end
	end},
	{"internal", title = "Internal", format = function(str)
		if str == "" then
			return "<span class='tag-internal'>This function is internal. Whilst you can call it, you probably shouldn't.</span>"
		else
			return "<span class='tag-internal'>This function is internal. Whilst you can call it, you probably shouldn't.<br>" .. markup(str) .. "</span>"
		end
	end}
}

Even if these aren't used internally, being able to define them for LuaLS to parse and export from the docs exporter in the json document would allow us to do post-processing on the files.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions