Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Formatting Directives

“Only in silence the word, only in dark the light, only in dying life: bright the hawk’s flight on the empty sky.”

— Ursula K. Le Guin, A Wizard of Earthsea

Surround regions you want left untouched with formatter directives:

-- fmt: off
local hand_formatted = {1,    2,   3,
                        100,  200, 300}
-- fmt: on

Everything between -- fmt: off and -- fmt: on is passed through verbatim. The directives themselves are preserved in the output.

Scoped usage

The directives are scope-aware. Place them inside any block to leave just that block unformatted while the rest of the file is formatted normally:

local function formatted()
    return 1 + 2
end

local function hand_crafted()
    -- fmt: off
    local matrix = {
        1, 0, 0,
        0, 1, 0,
        0, 0, 1,
    }
    return matrix
end

local function also_formatted()
    return 3 + 4
end