| 111 | paragraph_close() { return "" }, |
| 112 | |
| 113 | heading_open(token, _i, _t, newlines) { |
| 114 | let breaks = paraBreak(newlines) |
| 115 | if (token.tag == "h1") return `\\${!["hints", "intro"].includes(chapter[1]) ? "chapter" : noStarch ? "chapter*" : "addchap"}{` |
| 116 | if (token.tag == "h2") return `${breaks}${id(token)}\\section{` |
| 117 | if (token.tag == "h3") return `${breaks}${id(token)}\\subsection{` |
| 118 | if (token.tag == "h4") return `${breaks}${id(token)}\\subsubsection{` |
| 119 | throw new Error("Can't handle heading tag " + token.tag) |
| 120 | }, |
| 121 | heading_close(token) { |
| 122 | if (token.tag == "h1") return `}\\label{${chapter[1]}}` |
| 123 | return `}` |