Skip to content

Commit

Permalink
Line numbers: Exposed _resizeElement function (#2288)
Browse files Browse the repository at this point in the history
  • Loading branch information
RunDevelopment committed Apr 7, 2020
1 parent 1105319 commit 893f2a7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
18 changes: 14 additions & 4 deletions plugins/line-numbers/prism-line-numbers.js
Expand Up @@ -138,10 +138,10 @@
*/
Prism.plugins.lineNumbers = {
/**
* Get node for provided line number
* @param {Element} element pre element
* @param {Number} number line number
* @return {Element|undefined}
* Returns the node of the given line number in the given element.
* @param {Element} element A `<pre>` element with line numbers.
* @param {Number} number
* @returns {Element | undefined}
*/
getLine: function (element, number) {
if (element.tagName !== 'PRE' || !element.classList.contains(PLUGIN_NAME)) {
Expand All @@ -162,6 +162,16 @@
var lineIndex = number - lineNumberStart;

return lineNumberRows.children[lineIndex];
},
/**
* Resizes the line numbers of the given element.
*
* This function will not add line numbers. It will only resize existing ones.
* @param {Element} element A `<pre>` element with line numbers.
* @returns {void}
*/
resize: function (element) {
_resizeElement(element);
}
};

Expand Down
2 changes: 1 addition & 1 deletion plugins/line-numbers/prism-line-numbers.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 893f2a7

Please sign in to comment.