--- @brief
---<pre>help
---:TOhtml {file} *:TOhtml*
---Converts the buffer shown in the current window to HTML, opens the generated
---HTML in a new split window, and saves its contents to {file}. If {file} is not
---given, a temporary file (created by |tempname()|) is used.
---</pre>
-- The HTML conversion script is different from Vim's one. If you want to use
-- Vim's TOhtml converter, download it from the vim GitHub repo.
-- Here are the Vim files related to this functionality:
-- - https://github.com/vim/vim/blob/master/runtime/syntax/2html.vim
-- - https://github.com/vim/vim/blob/master/runtime/autoload/tohtml.vim
-- - https://github.com/vim/vim/blob/master/runtime/plugin/tohtml.vim
--
-- Main differences between this and the vim version:
-- - No "ignore some visual thing" settings (just set the right Vim option)
-- - No support for legacy web engines
-- - No support for legacy encoding (supports only UTF-8)
-- - No interactive webpage
-- - No specifying the internal HTML (no XHTML, no use_css=false)
-- - No multiwindow diffs
-- - No ranges
--
-- Remarks:
-- - Not all visuals are supported, so it may differ.
--- @class vim.tohtml.opt
--- @field title? string|false
--- @field number_lines? boolean
--- @field font? string[]|string
--- @field width? integer
--- @class vim.tohtml.state.global
--- @field background string
--- @field foreground string
--- @field title string|false
--- @field font string
--- @field highlights_name table<integer,string>
--- @field conf vim.tohtml.opt
--- @class vim.tohtml.state:vim.tohtml.state.global
--- @field style vim.tohtml.styletable
--- @field tabstop string|false
--- @field opt vim.wo
--- @field winid integer
--- @field bufnr integer
--- @field width integer
--- @field buflen integer
--- @class vim.tohtml.styletable
--- @field [integer] vim.tohtml.line (integer: (1-index, exclusive))
--- @class vim.tohtml.line
--- @field virt_lines {[integer]:{[1]:string,[2]:integer}[]}
--- @field pre_text string[][]
--- @field hide? boolean
--- @field [integer] vim.tohtml.cell? (integer: (1-index, exclusive))
--- @class vim.tohtml.cell
--- @field [1] integer[] start
--- @field [2] integer[] close
--- @field [3] any[][] virt_text
--- @field [4] any[][] overlay_text
local HIDE_ID = -1
-- stylua: ignore start
local cterm_8_to_hex={
[0] = "#808080", "#ff6060", "#00ff00", "#ffff00",
"#8080ff", "#ff40ff", "#00ffff", "#ffffff",
}
local cterm_16_to_hex={
[0] = "#000000", "#c00000", "#008000", "#804000",
"#0000c0", "#c000c0", "#008080", "#c0c0c0",
"#808080", "#ff6060", "#00ff00", "#ffff00",
"#8080ff", "#ff40ff", "#00ffff", "#ffffff",
}
local cterm_88_to_hex={
[0] = "#000000", "#c00000", "#008000", "#804000",
"#0000c0", "#c000c0", "#008080", "#c0c0c0",
"#808080", "#ff6060", "#00ff00", "#ffff00",
"#8080ff", "#ff40ff", "#00ffff", "#ffffff",
"#000000", "#00008b", "#0000cd", "#0000ff",
"#008b00", "#008b8b", "#008bcd", "#008bff",
"#00cd00", "#00cd8b", "#00cdcd", "#00cdff",
"#00ff00", "#00ff8b", "#00ffcd", "#00ffff",
"#8b0000", "#8b008b", "#8b00cd", "#8b00ff",
"#8b8b00", "#8b8b8b", "#8b8bcd", "#8b8bff",
"#8bcd00", "#8bcd8b", "#8bcdcd", "#8bcdff",
"#8bff00", "#8bff8b", "#8bffcd", "#8bffff",
"#cd0000", "#cd008b", "#cd00cd", "#cd00ff",
"#cd8b00", "#cd8b8b", "#cd8bcd", "#cd8bff",
"#cdcd00", "#cdcd8b", "#cdcdcd", "#cdcdff",
"#cdff00", "#cdff8b", "#cdffcd", "#cdffff",
"#ff0000", "#ff008b", "#ff00cd", "#ff00ff",
"#ff8b00", "#ff8b8b", "#ff8bcd", "#ff8bff",
"#ffcd00", "#ffcd8b", "#ffcdcd", "#ffcdff",
"#ffff00", "#ffff8b", "#ffffcd", "#ffffff",
"#2e2e2e", "#5c5c5c", "#737373", "#8b8b8b",
"#a2a2a2", "#b9b9b9", "#d0d0d0", "#e7e7e7",
}
local cterm_256_to_hex={
[0] = "#000000", "#c00000", "#008000", "#804000",
"#0000c0", "#c000c0", "#008080", "#c0c0c0",
"#808080", "#ff6060", "#00ff00", "#ffff00",
"#8080ff", "#ff40ff", "#00ffff", "#ffffff",
"#000000", "#00005f", "#000087"<
|