Skip to content

Commit 8d1f6a1

Browse files
authored
Merge pull request #22 from WebCoder49/prism-line-numbers
Prism line numbers
2 parents b37e7a3 + 2998490 commit 8d1f6a1

File tree

6 files changed

+30
-2
lines changed

6 files changed

+30
-2
lines changed

plugins/autocomplete.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/**
2+
* Display a popup under the caret using the text in the code-input element. This works well with autocomplete suggestions.
3+
* Files: autocomplete.js / autocomplete.css
4+
*/
15
code-input .code-input_autocomplete_popup {
26
display: block;
37
position: absolute;

plugins/autocomplete.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/**
2-
*
2+
* Display a popup under the caret using the text in the code-input element. This works well with autocomplete suggestions.
3+
* Files: autocomplete.js / autocomplete.css
34
*/
45
codeInput.plugins.Autocomplete = class extends codeInput.Plugin {
56
/**

plugins/autodetect.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/**
22
* Autodetect the language live and change the `lang` attribute using the syntax highlighter's
33
* autodetect capabilities. Works with highlight.js.
4+
* Files: autodetect.js
45
*/
56
codeInput.plugins.Autodetect = class extends codeInput.Plugin {
67
constructor() {

plugins/debounce-update.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/**
22
* Debounce the update and highlighting function
3-
* https://medium.com/@jamischarles/what-is-debouncing-2505c0648ff1
3+
* https://medium.com/@jamischarles/what-is-debouncing-2505c0648ff1
4+
* Files: debounce-update.js
45
*/
56
codeInput.plugins.DebounceUpdate = class extends codeInput.Plugin {
67
/**

plugins/indent.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/**
22
* Adds indentation using the `Tab` key, and auto-indents after a newline, as well as making it
33
* possible to indent/unindent multiple lines using Tab/Shift+Tab
4+
* Files: indent.js
45
*/
56
codeInput.plugins.Indent = class extends codeInput.Plugin {
67
constructor() {

plugins/prism-line-numbers.css

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/**
2+
* Allows code-input elements to be used with the Prism.js line-numbers plugin, as long as the code-input element
3+
* or a parent element of it has the CSS class `line-numbers`.
4+
* https://prismjs.com/plugins/line-numbers/
5+
* Files: prism-line-numbers.css
6+
*/
7+
/* Update padding to match line-numbers plugin */
8+
code-input.line-numbers textarea, code-input.line-numbers.code-input_pre-element-styled pre,
9+
.line-numbers code-input textarea, .line-numbers code-input.code-input_pre-element-styled pre {
10+
padding-top: 1em!important;
11+
padding-bottom: 1em!important;
12+
padding-right: 1em!important;
13+
padding-left: 3.8em!important;
14+
}
15+
16+
/* Remove unnecessary, interfering padding values */
17+
code-input.line-numbers, code-input.line-numbers.code-input_pre-element-styled code,
18+
.line-numbers code-input, .line-numbers code-input.code-input_pre-element-styled code{
19+
padding: 0;
20+
}

0 commit comments

Comments
 (0)