ldoc icon indicating copy to clipboard operation
ldoc copied to clipboard

@usage rendering retains leading white-space from source comment

Open E14 opened this issue 10 years ago • 2 comments

In a comment with @usage, all white-space from right after the double-dash is added to the rendered source code in documentation. This prevents clean copy&paste and also prevents developers from writing nice comments.

Example


---
-- @usage
--     foo = bar(flag, ...)

turns into

     foo = bar(flag, ...)

instead of

foo = bar(flag, ...)

When trying to remove all white-space from the start of the code in the comment, comments in the @usage sample code break the @usage context:


---
-- @usage
--foo = bar(flag, ...)
---- The next line is essential
--bar=bar-foo

E14 avatar Dec 26 '14 10:12 E14

Sorry about the delay - been MIA! The fix is to strip any leading spaces in usage blocks, based on the indentation of the first line.

stevedonovan avatar Jun 27 '16 14:06 stevedonovan

Sorry about the delay - been MIA!

It happens... cough (Okay, I blame GitHub notifications failing for mine.)

Anyway, my incredible test file renders great in LDoc 1.4.6, in case you were leaving this open due to missing confirmation :)

E14 avatar Nov 21 '16 14:11 E14

Fixed in 7bed1fa.

alerque avatar May 04 '23 20:05 alerque