You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: code-input.d.ts
+3-14Lines changed: 3 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -301,11 +301,10 @@ export class Template {
301
301
* @param {boolean} preElementStyled - is the `<pre>` element CSS-styled (if so set to true), or the `<code>` element (false)?
302
302
* @param {boolean} isCode - is this for writing code? If true, the code-input's lang HTML attribute can be used, and the `<code>` element will be given the class name 'language-[lang attribute's value]'.
303
303
* @param {false} includeCodeInputInHighlightFunc - Setting this to true passes the `<code-input>` element as a second argument to the highlight function.
304
-
* @param {boolean} autoDisableDuplicateSearching - Leaving this as true uses code-input's default fix for preventing duplicate results in Ctrl+F searching from the input and result elements, and setting this to false indicates your highlighting function implements its own fix. The default fix works by moving text content from elements to CSS `::before` pseudo-elements after highlighting.
305
304
* @param {codeInput.Plugin[]} plugins - An array of plugin objects to add extra features - see `codeInput.Plugin`
* **When `includeCodeInputInHighlightFunc` is `true`, `highlight` takes two parameters: the `<pre><code>` element, and the `<code-input>` element.**
311
310
*
@@ -315,25 +314,15 @@ export class Template {
315
314
* @param {boolean} preElementStyled - is the `<pre>` element CSS-styled (if so set to true), or the `<code>` element (false)?
316
315
* @param {boolean} isCode - is this for writing code? If true, the code-input's lang HTML attribute can be used, and the `<code>` element will be given the class name 'language-[lang attribute's value]'.
317
316
* @param {true} includeCodeInputInHighlightFunc - Setting this to true passes the `<code-input>` element as a second argument to the highlight function.
318
-
* @param {boolean} autoDisableDuplicateSearching - Leaving this as true uses code-input's default fix for preventing duplicate results in Ctrl+F searching from the input and result elements, and setting this to false indicates your highlighting function implements its own fix. The default fix works by moving text content from elements to CSS `::before` pseudo-elements after highlighting.
319
317
* @param {codeInput.Plugin[]} plugins - An array of plugin objects to add extra features - see `codeInput.Plugin`
true, /* Optional - Is the `pre` element styled as well as the `code` element?
194
+
* Changing this to false uses the code element as the scrollable one rather
195
+
* than the pre element */
196
+
197
+
true, /* Optional - This is used for editing code - setting this to true sets the `code`
198
+
* element's class to `language-<the code-input's lang attribute>` */
199
+
200
+
false /* Optional - Setting this to true passes the `<code-input>` element as a second
201
+
* argument to the highlight function to be used for getting data- attribute values
202
+
* and using the DOM for the code-input */,
203
+
204
+
[
205
+
// You can add or remove plugins in this list from https://code-input-js.org/plugins.
206
+
// All plugins used must be imported above.
207
+
new codeInput.plugins.Indent()
208
+
]
209
+
)
210
+
);
211
+
// Register templates with different names here, if needed.
212
+
</script>
213
+
</head>
214
+
<body>
215
+
<code-input template="syntax-highlighted"><textarea code-input-fallback>What will you create?
216
+
Code or something else?</textarea></code-input>
217
+
218
+
<!--Additional usage details are here: https://code-input-js.org/#pages-->
219
+
<!--A list of plugins are here: https://code-input-js.org/plugins-->
220
+
</body>
221
+
</html>
167
222
```
168
223
169
224
{{< /playground >}}
170
225
226
+
Next, you can [style your `code-input`](interface/css) and use it in [JavaScript](interface/js) or [HTML5 Forms](interface/forms).
227
+
171
228
## Features
172
229
173
230
<dl>
@@ -178,7 +235,7 @@ Choose Any Highlighter
178
235
</dt>
179
236
<dd>
180
237
181
-
Use the built in templates for [Prism.js](#demo-preset-prism) or [highlight.js](#demo-preset-hljs), or [pass in any function to highlight a normal HTML element](#demo-preset-custom), and `code-input.js` will do the editability for you. What will you create?
238
+
Use the built in templates for [Prism.js](#playground-preset-prism) or [highlight.js](#playground-preset-hljs), or [pass in any function to highlight a normal HTML element](#playground-preset-custom), and `code-input.js` will do the editability for you. What will you create?
182
239
183
240
</dd>
184
241
@@ -239,3 +296,5 @@ something like [CodeMirror](https://codemirror.net/),
**If you don't need web framework integration, get started with the commented tutorials by example on this page, for [Prism.js](#playground-preset-prism), [highlight.js](#playground-preset-hljs), or [another highlighter](#playground-preset-custom). If you're using a web framework, start [here](frameworks).**
title = 'Using code-input.js with custom highlighting algorihms in projects which use modules or frameworks'
3
+
+++
4
+
5
+
# Using code-input.js with custom highlighting algorithms in projects which use modules or frameworks
6
+
7
+
> Contributors: 2025 Oliver Geer
8
+
9
+
We plan to get documentation for this soon (contributions via a pull request are welcome!), but for now please use [the corresponding article for highlight.js](../hljs) and [the demo frameworkless code for code-input and custom highlighting algorithms](../../#playground-preset-custom).
title = 'Using code-input.js with highlight.js in projects which use modules or frameworks'
3
+
+++
4
+
# Using code-input.js with highlight.js in projects which use modules or frameworks
5
+
6
+
> Contributors: 2025 Oliver Geer
7
+
8
+
## Quickstart
9
+
*[Vue](vue)
10
+
*[Nuxt](nuxt)
11
+
12
+
## ESM: Technical Details
13
+
Since v2.6.0 `code-input.js` exposes ECMAScript modules in the `esm` directory, which allows importing the core functions from the module root or `code-input.mjs`, plugins from `plugins/name.mjs` as default exports and templates from `templates/name.mjs` as default exports. This allows easier integration with larger, more modular projects, including those that use front-end frameworks. See the `.d.mts` files in that directory for more details.
0 commit comments