I'm finding that nim doc generates ugly output for tables declared as const, presumably because of the compile time expansion. To see what I mean, run nim doc on the following example and compare the the way the identical tables are displayed in the let and const sections:
import tables
const
wonkyLookingTable* = {"a": 1, "b": 2, "c": 3}.toTable
let
betterLookingTable* = {"a": 1, "b": 2, "c": 3}.toTable
Is there any way to look around this? Is there some flag I can pass to nim doc to tell it to document const tables without evaluating them?
I dont understand what you mean, but basically it is showing you what the const literally is.
You can use macro to make a custom nnkCommentStmt.
import macros
macro docustom(): auto = newCommentStmtNode("This is my custom Doc")
expandMacros: docustom()
you can use "when defined(nimdoc)" to do specific thing on nimdoc.
In general, compile-time tables and compile-time object variants are ugly when printing due to how it's represented in the VM memory. Unfortunately I think this is a hard problem.