Skip to content

Commit 5c29801

Browse files
committed
Add more docs; organise docs for website
1 parent b3450e0 commit 5c29801

File tree

8 files changed

+54
-27
lines changed

8 files changed

+54
-27
lines changed

docs/_index.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title = 'Flexible Syntax Highlighted Editable Textareas'
33
+++
44

5-
# An <mark>editable</mark> `<textarea>` that supports *any* <mark>syntax highlighting</mark> algorithm, for code or something else. [Also, added plugins.](#TODO)
5+
# An <mark>editable</mark> `<textarea>` that supports *any* <mark>syntax highlighting</mark> algorithm, for code or something else. [Also, added plugins.](plugins)
66

77
Aiming to be [more <mark>flexible</mark>, <mark>lightweight</mark>,
88
<mark>modular</mark>, <mark>progressively enhanced</mark> and
@@ -47,7 +47,7 @@ console.log("Hello, World!");</textarea></code-input>
4747

4848
### Tutorials by Example
4949

50-
#### Prism.js Code Editor (use **with vanilla HTML here** or [with ECMAScript Modules/Vue/Nuxt](#TODO)) {#demo-preset-prism}
50+
#### Prism.js Code Editor (use **with vanilla HTML here** or [with ECMAScript Modules/Vue/Nuxt](/frameworks/prism)) {#demo-preset-prism}
5151

5252
```
5353
<!DOCTYPE html>
@@ -74,7 +74,7 @@ console.log("Hello, World!");</textarea></code-input>
7474
7575
<!--Import some code-input plugins-->
7676
<!--The same goes for downloaded versions.-->
77-
<!--Plugin files are here: #TODO.-->
77+
<!--Plugin files are here: https://code-input-js.org/plugins.-->
7878
<script src="https://cdn.jsdelivr.net/gh/WebCoder49/[email protected]/plugins/indent.min.js"></script>
7979
8080
<!--Register code-input template-->
@@ -83,7 +83,7 @@ console.log("Hello, World!");</textarea></code-input>
8383
new codeInput.templates.Prism(
8484
Prism,
8585
[
86-
// You can add or remove plugins in this list from #TODO.
86+
// You can add or remove plugins in this list from https://code-input-js.org/plugins.
8787
// All plugins used must be imported above.
8888
new codeInput.plugins.Indent()
8989
]
@@ -97,13 +97,13 @@ console.log("Hello, World!");</textarea></code-input>
9797
<code-input template="syntax-highlighted" language="JavaScript"><textarea code-input-fallback>// Demo editable code
9898
console.log("Hello, World!");</textarea></code-input>
9999
100-
<!--Additional usage details are here: #TODO-->
101-
<!--A list of plugins are here, allowing a well-rounded code-editor to be created quickly from code-input, if you're into that: #TODO-->
100+
<!--Additional usage details are here: https://code-input-js.org/#pages-->
101+
<!--A list of plugins are here, allowing a well-rounded code-editor to be created quickly from code-input, if you're into that: https://code-input-js.org/plugins-->
102102
</body>
103103
</html>
104104
```
105105

106-
#### highlight.js Code Editor (use **with vanilla HTML here** or [with ECMAScript Modules/Vue/Nuxt](#TODO)) {#demo-preset-hljs}
106+
#### highlight.js Code Editor (use **with vanilla HTML here** or [with ECMAScript Modules/Vue/Nuxt](frameworks/hljs)) {#demo-preset-hljs}
107107

108108
```
109109
<!DOCTYPE html>
@@ -131,7 +131,7 @@ console.log("Hello, World!");</textarea></code-input>
131131
132132
<!--Import some code-input plugins-->
133133
<!--The same goes for downloaded versions.-->
134-
<!--Plugin files are here: #TODO.-->
134+
<!--Plugin files are here: https://code-input-js.org/plugins.-->
135135
<script src="https://cdn.jsdelivr.net/gh/WebCoder49/[email protected]/plugins/indent.min.js"></script>
136136
137137
<!--Register code-input template-->
@@ -140,7 +140,7 @@ console.log("Hello, World!");</textarea></code-input>
140140
new codeInput.templates.Hljs(
141141
hljs,
142142
[
143-
// You can add or remove plugins in this list from #TODO.
143+
// You can add or remove plugins in this list from https://code-input-js.org/plugins.
144144
// All plugins used must be imported above.
145145
new codeInput.plugins.Indent()
146146
]
@@ -154,13 +154,13 @@ console.log("Hello, World!");</textarea></code-input>
154154
<code-input template="syntax-highlighted" language="JavaScript"><textarea code-input-fallback>// Demo editable code
155155
console.log("Hello, World!");</textarea></code-input>
156156
157-
<!--Additional usage details are here: #TODO-->
158-
<!--A list of plugins are here. We recommend the Autodetect plugin with highlight.js: #TODO-->
157+
<!--Additional usage details are here: https://code-input-js.org/#pages-->
158+
<!--A list of plugins are here. We recommend the Autodetect plugin with highlight.js: https://code-input-js.org/plugins-->
159159
</body>
160160
</html>
161161
```
162162

163-
#### Editor with Custom Highlighting Algorithm (use **with vanilla HTML here** or [with ECMAScript Modules/Vue/Nuxt](#TODO)) {#demo-preset-custom}
163+
#### Editor with Custom Highlighting Algorithm (use **with vanilla HTML here** or [with ECMAScript Modules/Vue/Nuxt](frameworks/custom)) {#demo-preset-custom}
164164

165165
```
166166
<!--custom: TODO-->
@@ -189,7 +189,7 @@ Extensible With Plugins
189189
</dt>
190190
<dd>
191191

192-
Want coding features like easy indentation and closing of brackets, tools like find and replace and go to line, or better integration like custom autocomplete popups and processing of selected highlighted tokens? [Try a selection of the easy-to-use plugins.](#TODO) Plugin not available? [Make one yourself as a JavaScript class!](#TODO)
192+
Want coding features like easy indentation and closing of brackets, tools like find and replace and go to line, or better integration like custom autocomplete popups and processing of selected highlighted tokens? [Try a selection of the easy-to-use plugins.](plugins) Plugin not available? [Make one yourself as a JavaScript class!](plugins/new)
193193

194194
</dd>
195195

docs/frameworks/custom/index.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
+++
2+
title = 'How to use code-input and Custom Highlighting Algorithms with Vue or Nuxt'
3+
+++
4+
5+
# How to use code-input and Custom Highlighting Algorithms with Vue or Nuxt
6+
7+
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) [the demo frameworkless code for code-input and custom highlighting algorithms](../../#demo-preset-custom).
Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
1-
# Vue/Nuxt Tutorial - For Highlight.js Integration
2-
3-
Vue and Nuxt have some similarities, but there is one big difference in how they can use this library. In Nuxt there is server side rendering (SSR) that will attempt to create the final HTML before sending the page to the browser. This cannot use any browser-specific things so the `code-input` component must be excluded from rendering until hydration in the browser.
1+
+++
2+
title = 'How to use code-input and highlight.js with Vue or Nuxt'
3+
+++
4+
5+
# How to use code-input and highlight.js with Vue or Nuxt
46

5-
> [!NOTE]
6-
> The following demo is for integrating with `highlight.js` but if you follow the instructions in [the main README](../README.md) you can substitute highlight.js for Prism.js or a custom template.
7+
> Contributors: 2025 Paul Rosen
78
9+
Vue and Nuxt have some similarities, but there is one big difference in how they can use this library. In Nuxt there is server side rendering (SSR) that will attempt to create the final HTML before sending the page to the browser. This cannot use any browser-specific things so the `code-input` component must be excluded from rendering until hydration in the browser.
10+
811
## Vue
912

1013
### 1. Create a Vue app
1114

1215
First, create a Vue project. (If you already have a Vue project then you can skip this step). On a command line, type this:
13-
```
16+
```bash
1417
npm create vue@latest
1518
```
1619
At the time this tutorial was created, the output was the following, after I named the project `syntax-highlighter` and checked "typescript":
17-
```
20+
```plaintext
1821
Need to install the following packages:
1922
2023
Ok to proceed? (y) y
@@ -87,7 +90,7 @@ So that Vue knows that `code-input` is not a Vue component.
8790
### 3. Initialize the textarea
8891

8992
Create a component with whatever name you want. Perhaps `RichEditor.vue`. Paste the following into it:
90-
```vue
93+
```html
9194
<template>
9295
<code-input name="richText">function hello() { console.log("world"); }
9396
</code-input>
@@ -132,12 +135,12 @@ code-input {
132135
### 4. Using the component
133136

134137
In the generated file `HelloWorld.vue`, place the following line after the "greetings" line:
135-
```vue
138+
```html
136139
<RichEditor />
137140
```
138141

139142
And put its import in the `<script>` section:
140-
```vue
143+
```html
141144
import RichEditor from "@/components/RichEditor.vue";
142145
```
143146

@@ -159,7 +162,7 @@ First, create a Nuxt project. (If you already have a Nuxt project then you can s
159162
npm create nuxt@latest syntax-highlighter
160163
```
161164
At the time this tutorial was created, the output was the following:
162-
```
165+
```plaintext
163166
Need to install the following packages:
164167
165168
Ok to proceed? (y) y
@@ -254,7 +257,7 @@ So that the necessary css is loaded for code-input, and an example theme is load
254257

255258
Create a component with whatever name you want. Perhaps `app/components/RichEditor.vue`. Paste the following into it:
256259

257-
```vue
260+
```html
258261
<template>
259262
<div class="rich-editor">
260263
<!-- Use ClientOnly so that no SSR is done on the code-input component -->
@@ -341,12 +344,12 @@ code-input textarea::selection {
341344
### 4. Using the component
342345
343346
In the generated file `app.vue`, place the following line after the "NuxtRouteAnnouncer" line:
344-
```vue
347+
```html
345348
<RichEditor value="function hello() { console.log('world'); }" name="myEditor" />
346349
```
347350
348351
And put its import in the `<script>` section:
349-
```vue
352+
```html
350353
import RichEditor from "./components/RichEditor.vue";
351354
```
352355
File renamed without changes.
File renamed without changes.

docs/frameworks/prism/index.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
+++
2+
title = 'How to use code-input and Prism.js with Vue or Nuxt'
3+
+++
4+
5+
# How to use code-input and Prism.js with Vue or Nuxt
6+
7+
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 Prism.js](../../#demo-preset-prism).

docs/plugins/list/index.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
+++
2+
title = "code-input.js' Existing Plugins"
3+
+++
4+
5+
# TODO

docs/plugins/new/index.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
+++
2+
title = 'Creating your own code-input Plugin to add functionality'
3+
+++
4+
5+
# TODO

0 commit comments

Comments
 (0)