Open pablomayobre opened 9 years ago
Other option would be to use tables, but I'm not really sure about that
description = {
"This is the description of some function and it has some wild",
{text="links.", url="https://www.love2d.org/"},
"It can also have links that redirect to functions like:",
{text="love.filesystem.getDirectoryItems", function={"filesystem","getDirectoryItems"}}
}
This makes the function pretty simple though:
function (description)
result = ""
for i=1, #description do
if type(description[i]) == "string" then
result = result .. " " .. description[i] --Not sure about the space there
else
result = result .. " " .. description[i].text
end
end
return result
end
Adding urls from the wiki would be nice for docs too.
{
name = 'getContactFilter',
description = 'Returns the function for collision filtering.',
url = 'https://love2d.org/wiki/World:getContactFilter',
variants = {
{
returns = {
{
type = 'function',
name = 'contactFilter',
description = 'The function that handles the contact filtering.'
}
}
}
}
},
I added automatic linking to functions and types to the reference generator code, you can see the output here: http://love2d-community.github.io/love-api/test/#Body_getLinearVelocity
As discussed in the forum thread, having local links pointing to other sections of the doc would be nice, also having external links wouldnt hurt either. I would love to work on this feature, just wanted to know what format should we use for the links.
I was thinking that maybe using
to enclose the text would be nice for local links and something like markdown
[]()
syntax for external links.What do you say?
Also there should be a method to get the url for a link (parse the text?), and a method to completely unformat the text (delete the characters
[]()
, ` and links in order to make it clearer)