From 36b2e0b5f49861ebe04aa410130fc4a12ed2b3eb Mon Sep 17 00:00:00 2001 From: defanor Date: Fri, 17 Nov 2017 05:45:41 +0300 Subject: Narrow footnotes The "note N" strings add to the overall width, so the width of notes themselves should be reduced. It's different in CLI and Emacs, and rather imprecise here, so can still be improved -- but at least overflow is unlikely now. --- Pancake/Rendering.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'Pancake') diff --git a/Pancake/Rendering.hs b/Pancake/Rendering.hs index 24afcfc..2c1823a 100644 --- a/Pancake/Rendering.hs +++ b/Pancake/Rendering.hs @@ -336,7 +336,9 @@ readInline (P.Image attr alt (url, title)) = do readInline (P.Note bs) = do -- Minor issues are quite likely with this. st <- get - let ro = runRenderer (columns st) (linkCount st) (noteCount st) 0 + -- 12 is somewhat arbitrary, but narrowing the rendered notes so + -- that "^{note xxx}" could be added without overflow. + let ro = runRenderer (columns st - 12) (linkCount st) (noteCount st) 0 (renderBlocks bs) cnt <- storeNote ro pure [Superscript . Fg Red . fromString $ "[" ++ show cnt ++ "]"] -- cgit v1.2.3