Skip to content

Commit 6e5cc9e

Browse files
committed
Fine tune appearance
1 parent f07feb7 commit 6e5cc9e

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

src/resources/filters/quarto-pre/code-annotation.lua

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,10 @@ function code()
395395

396396
for i, block in ipairs(blocks) do
397397
if block.t == 'Div' and block.attr.classes:find('cell') then
398-
-- walk to find the code and
398+
-- Process executable code blocks
399+
-- In the case of executable code blocks, we actually want
400+
-- to shift the OL up above the output, so we hang onto this outer
401+
-- cell so we can move the OL up into it if there are annotations
399402
local processedAnnotation = false
400403
local resolvedBlock = pandoc.walk_block(block, {
401404
CodeBlock = function(el)
@@ -414,14 +417,19 @@ function code()
414417
end
415418
})
416419
if processedAnnotation then
420+
-- we found annotations, so hand onto this cell
417421
pendingCodeCell = resolvedBlock
418422
else
423+
-- no annotations, just output it
419424
outputBlock(resolvedBlock)
420425
end
421426
elseif block.t == 'CodeBlock' then
422427
-- don't process code cell output here - we'll get it above
428+
-- This processes non-executable code blocks
423429
if not block.attr.classes:find('cell-code') then
424430

431+
-- If there is a pending code cell and we get here, just
432+
-- output the pending code cell and continue
425433
if pendingCodeCell then
426434
outputBlock(pendingCodeCell)
427435
clearPending()

src/resources/formats/html/templates/quarto-html.ejs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -380,8 +380,8 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
380380
div.style.position = 'absolute';
381381
parent.appendChild(div);
382382
}
383-
div.style.top = top - 1 + "px";
384-
div.style.height = height + "px";
383+
div.style.top = top - 2 + "px";
384+
div.style.height = height + 4 + "px";
385385
386386
let gutterDiv = window.document.getElementById("code-annotation-line-highlight-gutter");
387387
if (gutterDiv === null) {
@@ -393,8 +393,8 @@ window.document.addEventListener("DOMContentLoaded", function (event) {
393393
gutter.appendChild(gutterDiv);
394394
}
395395
396-
gutterDiv.style.top = top - 1 + "px";
397-
gutterDiv.style.height = height + "px";
396+
gutterDiv.style.top = top - 2 + "px";
397+
gutterDiv.style.height = height + 4 + "px";
398398
}
399399
selectedAnnoteEl = annoteEl;
400400
}

0 commit comments

Comments
 (0)