code-input

WebCoder49MIT活跃维护

把普通 textarea 变成支持任意语法高亮算法的可编辑代码输入框,插件化设计,适合在网页里嵌入轻量代码编辑器。

code-input.js: An editable <textarea> that supports any syntax highlighting algorithm, for code or something else. Also, added plugins. [contribute here or on https://codeberg.org/code-input-js/code-input-js]

v2.9.0发布于 2026-09-18 20:57 UTC241star34fork同步于 2026-11-07 07:32 UTC

怎么上手

README 里没有找到可直接复制的安装命令

README 里没有找到可直接复制的安装命令,请到 README 或官方文档查看安装方式。

硬件要求

README 没有说明硬件要求。

下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

这个项目的说明还在生成中,先参考下面「最近发版」和 README。

最近发版

5 个版本v2.9.0
  1. v2.9.02.9.0最新正式版2026-09-18 · 2026-09-18 20:57 UTC

    🆕 What's in this release?

    :tada: As always, if you find any bug or have any idea for enhancement (for this release or breaking changes for major version 3), please let me know!

  2. v2.8.42.8.42026-09-06 · 2026-09-06 23:38 UTC
    查看更新说明

    Bug Fixes

    • The TypeScript declaration files now have tests and fixes for their previous compilation errors. #235

    🎉 Thanks for this release goes to @brettz9 for pointing out the bugs in #233 and helping test them. As always, if you find any bug or have any idea for enhancement (for this release or breaking changes for major version 3), please let me know!

  3. v2.8.32.8.32026-07-03 · 2026-07-03 14:17 UTC
    查看更新说明

    Bug Fixes

    • Before a template is registered, the fallback textarea shown will no longer overlap with the notice saying it's unregistered. #224
    • Fixed a bug when setting attributes on <code-input> elements via JavaScript. #228
    • Added several tests to the test suite, including ones for these bugs.
    • Documented how to prevent bugs when importing fonts with bold weights, here. #130

    As always, if you find any bug or have any idea for enhancement (for this release or breaking changes for major version 3), please let me know! 🎉

  4. v2.8.22.8.22026-03-17 · 2026-03-17 23:25 UTC
    查看更新说明

    Bug Fixes

    • Some polishing for FindAndReplace and GoToLine plugins: when no text is in the input box, it will consistently not be styled like an error has occurred, rather than sometimes having error styles, and sometimes not. #220
    • In these plugins, error styles have been adjusted so they do not damage the contrast ratio of the inputted text, making the text harder to read - full rationale is in the issue: #218
    • There's some specialised documentation: how to cache code-input elements correctly so they work with Single-Page Application frameworks like Turbo, in /interface/js #219

    As always, if you find any bug or have any idea for enhancement (for this release or breaking changes for major version 3), please let me know! 🎉

  5. v2.8.12.8.12026-01-21 · 2026-01-21 23:12 UTC
    查看更新说明

    Bug Fixes

    • The new Autogrow plugin now works correctly with the progressive enhancement fallback textareas (<textarea data-code-input fallback). - #213
    • The fallback textareas, which have been recommended since release 2.6, are now included in all of the plugins demos.
    • A few other small fixes to the documentation.

    As always, if you find any bug or have any idea for enhancement (for this release or breaking changes for major version 3), please let me know! 🎉

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    code-input.js

    Click to SwitchWebsite and DemosGitHubCodebergYarnNPM

    View License View Releases

    An editable <textarea> that supports any syntax highlighting algorithm, for code or something else. Also, added plugins.

    Aiming to be more flexible, lightweight, modular, progressively enhanced and standards-based than the alternatives, we support HTML forms, the <textarea> JavaScript interface, more languages and more use cases.


    Demos and usage instructions are available at https://code-input-js.org and the docs directory, to let you get started quickly!


    A lightweight setup like the animation below is still the default for code-input.js, but a wide range of plugins are available to modularly and progressively enhance the experience - see the website for interactive demos!

    Using code-input with many different themes This demonstration uses themes from Prism.js and highlight.js, two syntax-highlighting programs which work well with and have compatibility built-in with code-input.

    Contributing

    If you have any features you would like to add to code-input as plugins or core functionality, or have found any bugs, please open an issue or fork and submit a pull request! All contributions to this open-source project will be greatly appreciated. You can see more info in our CONTRIBUTING.md file.

    If you find a sensitive security vulnerability in the code-input.js library, please email the maintainer Oliver Geer at [email protected], optionally using this encryption key. GitHub security advisories (different to the more general "issues") are also accepted.

    Contributors
    ...have contributed pull requests so far.
    (source: contrib.rocks)