Putting in new-line characters in the empty lines has fixed copy+paste and made the min-height css unnecessary.

This commit is contained in:
Tom Alexander 2023-08-18 17:20:45 -04:00
parent 51b4eed034
commit 4fb203c1db
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
3 changed files with 3 additions and 7 deletions

View File

@ -8,6 +8,6 @@
<h2>Input org-mode source:</h2>
<textarea id="org-input" rows="24" cols="80"></textarea>
<hr/>
<div id="parse-output" class="code_block" style="padding-left: calc(2ch + 10px); counter-set: code_line_number 0;"><code>This is line 1</code><code class="highlighted">This is line 2</code><code>This is line 3</code></div>
<div id="parse-output" class="code_block" style="counter-set: code_line_number 0;"></div>
</body>
</html>

View File

@ -19,14 +19,11 @@ async function renderParseResponse(response) {
const numLines = lines.length;
const numDigits = Math.log10(numLines) + 1;
// outputElement.style.counterSet = "code_line_number 0;";
outputElement.style.paddingLeft = `calc(${numDigits + 1}ch + 10px);`;
outputElement.style.paddingLeft = `calc(${numDigits + 1}ch + 10px)`;
// TODO: Do I need to set counter-set?
console.log(lines);
for (let line of lines) {
let wrappedLine = document.createElement("code");
wrappedLine.textContent = line;
wrappedLine.textContent = line ? line : "\n";
outputElement.appendChild(wrappedLine);
}
}

View File

@ -35,7 +35,6 @@ h7 {
.code_block > code {
display: table;
counter-increment: code_line_number;
min-height: 1.4em;
}
.code_block > code::before {