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:
parent
51b4eed034
commit
4fb203c1db
@ -8,6 +8,6 @@
|
|||||||
<h2>Input org-mode source:</h2>
|
<h2>Input org-mode source:</h2>
|
||||||
<textarea id="org-input" rows="24" cols="80"></textarea>
|
<textarea id="org-input" rows="24" cols="80"></textarea>
|
||||||
<hr/>
|
<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>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -19,14 +19,11 @@ async function renderParseResponse(response) {
|
|||||||
const numLines = lines.length;
|
const numLines = lines.length;
|
||||||
const numDigits = Math.log10(numLines) + 1;
|
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) {
|
for (let line of lines) {
|
||||||
let wrappedLine = document.createElement("code");
|
let wrappedLine = document.createElement("code");
|
||||||
wrappedLine.textContent = line;
|
wrappedLine.textContent = line ? line : "\n";
|
||||||
outputElement.appendChild(wrappedLine);
|
outputElement.appendChild(wrappedLine);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,6 @@ h7 {
|
|||||||
.code_block > code {
|
.code_block > code {
|
||||||
display: table;
|
display: table;
|
||||||
counter-increment: code_line_number;
|
counter-increment: code_line_number;
|
||||||
min-height: 1.4em;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.code_block > code::before {
|
.code_block > code::before {
|
||||||
|
Loading…
Reference in New Issue
Block a user