Skip to content

Commit fe7db3f

Browse files
committed
Finalise docs
1 parent 6df10b1 commit fe7db3f

File tree

7 files changed

+173
-3
lines changed

7 files changed

+173
-3
lines changed

docs/LICENSE

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
License files in this directory are only for the documentation in the `docs` directory, and not for the `code-input` library itself (see its top-level LICENSE file). This is because licenses designed for code do not work well for text. This differentiation also simplifies usage of the tutorials by typically not requiring attribution of their code snippets. The licenses chosen are later versions of those used for the popular Mozilla Developer Network web platform documentation.
2+
3+
Except where otherwise noted, content licensed [CC-BY-SA 4.0](LICENSE.CC-BY-SA-4.0), copyright its authors identified at the top of the page, and code snippets presented in tutorials dedicated to the public domain under [CC0-1.0](LICENSE.CC0-1.0).

docs/LICENSE.CC-BY-SA-4.0

Lines changed: 116 additions & 0 deletions
Large diffs are not rendered by default.

docs/LICENSE.CC0-1.0

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
Creative Commons Legal Code
2+
3+
CC0 1.0 Universal
4+
5+
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED HEREUNDER.
6+
7+
Statement of Purpose
8+
9+
The laws of most jurisdictions throughout the world automatically confer exclusive Copyright and Related Rights (defined below) upon the creator and subsequent owner(s) (each and all, an "owner") of an original work of authorship and/or a database (each, a "Work").
10+
11+
Certain owners wish to permanently relinquish those rights to a Work for the purpose of contributing to a commons of creative, cultural and scientific works ("Commons") that the public can reliably and without fear of later claims of infringement build upon, modify, incorporate in other works, reuse and redistribute as freely as possible in any form whatsoever and for any purposes, including without limitation commercial purposes. These owners may contribute to the Commons to promote the ideal of a free culture and the further production of creative, cultural and scientific works, or to gain reputation or greater distribution for their Work in part through the use and efforts of others.
12+
13+
For these and/or other purposes and motivations, and without any expectation of additional consideration or compensation, the person associating CC0 with a Work (the "Affirmer"), to the extent that he or she is an owner of Copyright and Related Rights in the Work, voluntarily elects to apply CC0 to the Work and publicly distribute the Work under its terms, with knowledge of his or her Copyright and Related Rights in the Work and the meaning and intended legal effect of CC0 on those rights.
14+
15+
1. Copyright and Related Rights. A Work made available under CC0 may be protected by copyright and related or neighboring rights ("Copyright and Related Rights"). Copyright and Related Rights include, but are not limited to, the following:
16+
i. the right to reproduce, adapt, distribute, perform, display, communicate, and translate a Work;
17+
ii. moral rights retained by the original author(s) and/or performer(s);
18+
iii. publicity and privacy rights pertaining to a person's image or likeness depicted in a Work;
19+
iv. rights protecting against unfair competition in regards to a Work, subject to the limitations in paragraph 4(a), below;
20+
v. rights protecting the extraction, dissemination, use and reuse of data in a Work;
21+
vi. database rights (such as those arising under Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, and under any national implementation thereof, including any amended or successor version of such directive); and
22+
vii. other similar, equivalent or corresponding rights throughout the world based on applicable law or treaty, and any national implementations thereof.
23+
2. Waiver. To the greatest extent permitted by, but not in contravention of, applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and unconditionally waives, abandons, and surrenders all of Affirmer's Copyright and Related Rights and associated claims and causes of action, whether now known or unknown (including existing as well as future claims and causes of action), in the Work (i) in all territories worldwide, (ii) for the maximum duration provided by applicable law or treaty (including future time extensions), (iii) in any current or future medium and for any number of copies, and (iv) for any purpose whatsoever, including without limitation commercial, advertising or promotional purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each member of the public at large and to the detriment of Affirmer's heirs and successors, fully intending that such Waiver shall not be subject to revocation, rescission, cancellation, termination, or any other legal or equitable action to disrupt the quiet enjoyment of the Work by the public as contemplated by Affirmer's express Statement of Purpose.
24+
3. Public License Fallback. Should any part of the Waiver for any reason be judged legally invalid or ineffective under applicable law, then the Waiver shall be preserved to the maximum extent permitted taking into account Affirmer's express Statement of Purpose. In addition, to the extent the Waiver is so judged Affirmer hereby grants to each affected person a royalty-free, non transferable, non sublicensable, non exclusive, irrevocable and unconditional license to exercise Affirmer's Copyright and Related Rights in the Work (i) in all territories worldwide, (ii) for the maximum duration provided by applicable law or treaty (including future time extensions), (iii) in any current or future medium and for any number of copies, and (iv) for any purpose whatsoever, including without limitation commercial, advertising or promotional purposes (the "License"). The License shall be deemed effective as of the date CC0 was applied by Affirmer to the Work. Should any part of the License for any reason be judged legally invalid or ineffective under applicable law, such partial invalidity or ineffectiveness shall not invalidate the remainder of the License, and in such case Affirmer hereby affirms that he or she will not (i) exercise any of his or her remaining Copyright and Related Rights in the Work or (ii) assert any associated claims and causes of action with respect to the Work, in either case contrary to Affirmer's express Statement of Purpose.
25+
4. Limitations and Disclaimers.
26+
a. No trademark or patent rights held by Affirmer are waived, abandoned, surrendered, licensed or otherwise affected by this document.
27+
b. Affirmer offers the Work as-is and makes no representations or warranties of any kind concerning the Work, express, implied, statutory or otherwise, including without limitation warranties of title, merchantability, fitness for a particular purpose, non infringement, or the absence of latent or other defects, accuracy, or the present or absence of errors, whether or not discoverable, all to the greatest extent permissible under applicable law.
28+
c. Affirmer disclaims responsibility for clearing rights of other persons that may apply to the Work or any use thereof, including without limitation any person's Copyright and Related Rights in the Work. Further, Affirmer disclaims responsibility for obtaining any necessary consents, permissions or other rights required for any use of the Work.
29+
d. Affirmer understands and acknowledges that Creative Commons is not a party to this document and has no duty or obligation with respect to this CC0 or use of the Work.
30+

docs/_index.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@ title = 'Flexible Syntax Highlighted Editable Textareas'
66

77
Aiming to be [more <mark>flexible</mark>, <mark>lightweight</mark>,
88
<mark>modular</mark>, <mark>progressively enhanced</mark> and
9-
<mark>standards-based</mark></a> than the alternatives](#features), we support
9+
<mark>standards-based</mark than the alternatives](#features), we support
1010
[HTML forms](interface/forms), the [`<textarea>` JavaScript interface](interface/js), more languages and
1111
more use cases.
1212

13+
*code-input.js is free, libre, open source software under the MIT (AKA Expat) license.* **Download it [from the Git repository](https://github.com/WebCoder49/code-input/tree/v2.6.0), [in a ZIP archive](/release/code-input-js-v2.6.0.zip), [in a TAR.GZ archive](/release/code-input-js-v2.6.0.tar.gz), or from `@webcoder49/code-input` on the NPM registry ([Yarn](https://yarnpkg.com/package?name=@webcoder49/code-input), [NPM](https://npmjs.com/package/@webcoder49/code-input), etc.).**
14+
1315
## Get Started with a Demo
1416

1517
{{< playground >}}
@@ -298,3 +300,9 @@ something like [CodeMirror](https://codemirror.net/),
298300

299301
## Read Enough?
300302
**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 ECMAScript modules or a web framework, start [here](modules-and-frameworks).**
303+
304+
## Contribute Bug Reports / Code / Docs {contributing}
305+
306+
code-input.js is collaboratively developed by many people, which is what keeps it going strong. By version 2.6.0, many have reported bugs and suggestions, and 9 people have contributed code or documentation directly. If you have found a bug, would like to help with the code or documentation, or have additional suggestions, for plugins or core functionality, [please look at GitHub]() or [get in touch via email](mailto:code-input-js@webcoder49.dev)!
307+
308+
*We're looking into mirroring code-input.js onto Codeberg as well as GitHub for more flexibility and freedom - if you have ideas for this please email!*

docs/i18n/_index.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,20 @@ title = 'Internationalising code-input.js'
44

55
# Internationalising code-input.js
66

7-
> Contributors: 2021 Oliver Geer
7+
> Contributors: 2025 Oliver Geer
88
99
## Languages
1010

11-
code-input.js defaults to using English text, but when want the interface in a different language you can provide text in a different language.
11+
code-input.js defaults to using English text for its interface, but when you want it in a different language you can provide the translated text:
1212

1313
**The core of code-input.js** contains one message shown only when CSS is supported but JavaScript has not been used to register the element. Translate it by writing the following CSS rule, replacing the text with its localised version.
14+
1415
```css
1516
code-input:not(.code-input_registered)::after {
1617
content: "No highlighting. JavaScript support is disabled or insufficient, or codeInput.registerTemplate has not been called."!important;
1718
}
1819
```
20+
1921
It is only present for debugging and explanatory purposes when highlighting cannot be seen, and should not contain important or specific information about the editor state; if you need such information, especially for screen reader users, add separate text to your application which disappears after registering the code-input without errors.
2022

2123
**Plugins** sometimes come with user interface features (e.g. the find-and-replace dialog) which contain text to be translated. The text is provided as an extra argument to the plugin constructor containing translated strings or functions to produce them for each translation key, with the keys and their English values found in either the `code-input.d.ts` or the plugin's source code file. Here's an example:

docs/interface/css/_index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ title = 'Styling `code-input` elements with CSS'
99
`code-input` elements can be styled like `textarea` elements in most cases; however, there are some exceptions:
1010
* The CSS variable `--padding` should be used rather than the property `padding` (e.g. `<code-input style="--padding: 10px;">...`)
1111
* Background colours set on `code-input` elements will not work with highlighters that set background colours themselves - use `(code-input's selector) pre[class*="language-"]` for Prism.js, `(code-input's selector) TODO` for highlight.js to target the highlighted element with higher specificity than the highlighter's theme.
12+
* For now, elements on top of `code-input` elements should have a CSS `z-index` at least 3 greater than the `code-input` element.

docs/plugins/_index.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ title = "Adding Extra Functionality With code-input.js' Plugins"
1515
<!DOCTYPE html>
1616
<html>
1717
<body>
18+
<!--For convenience, this demo uses files from JSDelivr CDN; for more privacy and security download and host them yourself.-->
19+
1820
<!--Prism+code-input-->
1921
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/components/prism-core.min.js" data-manual></script><!--Remove data-manual if also using Prism normally-->
2022
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/plugins/autoloader/prism-autoloader.min.js"></script>
@@ -51,6 +53,7 @@ title = "Adding Extra Functionality With code-input.js' Plugins"
5153
<!DOCTYPE html>
5254
<html>
5355
<body>
56+
<!--For convenience, this demo uses files from JSDelivr CDN; for more privacy and security download and host them yourself.-->
5457
<!--Prism+code-input-->
5558
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/components/prism-core.min.js" data-manual></script><!--Remove data-manual if also using Prism normally-->
5659
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/plugins/autoloader/prism-autoloader.min.js"></script>
@@ -124,6 +127,7 @@ title = "Adding Extra Functionality With code-input.js' Plugins"
124127
<!DOCTYPE html>
125128
<html>
126129
<body>
130+
<!--For convenience, this demo uses files from JSDelivr CDN; for more privacy and security download and host them yourself.-->
127131
<!--Prism+code-input-->
128132
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/components/prism-core.min.js" data-manual></script><!--Remove data-manual if also using Prism normally-->
129133
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/plugins/autoloader/prism-autoloader.min.js"></script>
@@ -169,6 +173,7 @@ Hickory dickory dock.</code-input>
169173
<!DOCTYPE html>
170174
<html>
171175
<body>
176+
<!--For convenience, this demo uses files from JSDelivr CDN; for more privacy and security download and host them yourself.-->
172177
<!--Prism+code-input-->
173178
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/components/prism-core.min.js" data-manual></script><!--Remove data-manual if also using Prism normally-->
174179
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/plugins/autoloader/prism-autoloader.min.js"></script>
@@ -215,6 +220,7 @@ Hickory dickory dock.</code-input>
215220
<!DOCTYPE html>
216221
<html>
217222
<body>
223+
<!--For convenience, this demo uses files from JSDelivr CDN; for more privacy and security download and host them yourself.-->
218224
<!--Prism+code-input-->
219225
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/components/prism-core.min.js" data-manual></script><!--Remove data-manual if also using Prism normally-->
220226
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/plugins/autoloader/prism-autoloader.min.js"></script>
@@ -499,6 +505,7 @@ Hickory dickory dock.</code-input>
499505
<script src="https://cdn.jsdelivr.net/gh/WebCoder49/code-input@2.6/plugins/select-token-callbacks.min.js"></script>
500506
</head>
501507
<body>
508+
<!--For convenience, this demo uses files from JSDelivr CDN; for more privacy and security download and host them yourself.-->
502509
503510
<script>
504511
codeInput.registerTemplate("syntax-highlighted", new codeInput.templates.Prism(Prism, [
@@ -553,6 +560,7 @@ See https://github.com/WebCoder49/code-input/issues?q=is%3Aissue%20state%3Aopen%
553560
<!DOCTYPE html>
554561
<html>
555562
<body>
563+
<!--For convenience, this demo uses files from JSDelivr CDN; for more privacy and security download and host them yourself.-->
556564
<!--Prism+code-input-->
557565
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/components/prism-core.min.js" data-manual></script><!--Remove data-manual if also using Prism normally-->
558566
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/plugins/autoloader/prism-autoloader.min.js"></script>
@@ -598,6 +606,7 @@ See https://github.com/WebCoder49/code-input/issues?q=is%3Aissue%20state%3Aopen%
598606
<!DOCTYPE html>
599607
<html>
600608
<body>
609+
<!--For convenience, this demo uses files from JSDelivr CDN; for more privacy and security download and host them yourself.-->
601610
<!--highlight.js+code-input-->
602611
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.11.1/styles/default.min.css">
603612
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.11.1/highlight.min.js"></script>
@@ -629,6 +638,7 @@ See https://github.com/WebCoder49/code-input/issues?q=is%3Aissue%20state%3Aopen%
629638
<!DOCTYPE html>
630639
<html>
631640
<body>
641+
<!--For convenience, this demo uses files from JSDelivr CDN; for more privacy and security download and host them yourself.-->
632642
<!--Prism+code-input-->
633643
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/components/prism-core.min.js" data-manual></script><!--Remove data-manual if also using Prism normally-->
634644
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/plugins/autoloader/prism-autoloader.min.js"></script>

0 commit comments

Comments
 (0)