Skip to content

Commit

Permalink
Bug fixed: highlight lines align incorrectly without line number
Browse files Browse the repository at this point in the history
  • Loading branch information
lijyze committed Jul 28, 2023
1 parent 588e2f4 commit 3fb80aa
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 8 deletions.
4 changes: 2 additions & 2 deletions lib/prism-line-highlight.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,9 @@ export function extendLineHighlightPlugin (Prism) {
var offset = +pre.getAttribute('data-line-offset') || 0;

var parseMethod = isLineHeightRounded() ? parseInt : parseFloat;
var lineHeight = parseMethod(getComputedStyle(pre).lineHeight);
var hasLineNumbers = Prism.util.isActive(pre, LINE_NUMBERS_CLASS);
var codeElement = pre.querySelector('code');
var lineHeight = parseMethod(getComputedStyle(codeElement).lineHeight);
var hasLineNumbers = Prism.util.isActive(pre, LINE_NUMBERS_CLASS);
var parentElement = hasLineNumbers ? pre : codeElement || pre;
var mutateActions = /** @type {(() => void)[]} */ ([]);
var lineBreakMatch = codeElement.textContent.match(NEW_LINE_REGEX);
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "obsidian-advanced-codeblock",
"name": "Advanced Codeblock",
"version": "1.1.4",
"version": "1.1.5",
"minAppVersion": "0.12.0",
"description": "Give additioinal features to code blocks.",
"author": "Lijyze",
Expand Down
4 changes: 0 additions & 4 deletions styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,6 @@ pre[data-line] {
white-space: pre;
}

code .line-highlight {
margin-top: 2em;
}

@media print {
.line-highlight {
/*
Expand Down
3 changes: 2 additions & 1 deletion versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
"1.1.0": "0.12.0",
"1.1.1": "0.12.0",
"1.1.2": "0.12.0",
"1.1.4": "0.12.0"
"1.1.4": "0.12.0",
"1.1.5": "0.12.0"
}

0 comments on commit 3fb80aa

Please sign in to comment.