Skip to content

Commit db37085

Browse files
committed
Docs: wrap.
1 parent ff3588a commit db37085

20 files changed

+109
-71
lines changed

builder/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
# [http://www.gnu.org/licenses/](http://www.gnu.org/licenses/).
1818
#
1919
# `Cargo.toml` -- Rust build/package management config for the builder
20-
# ====================================================================
20+
# ==============================================================================
2121
[package]
2222
name = "builder"
2323
version = "0.1.0"

builder/src/main.rs

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,19 @@
1414
// the CodeChat Editor. If not, see
1515
// [http://www.gnu.org/licenses](http://www.gnu.org/licenses).
1616
/// `main.rs` -- Entrypoint for the CodeChat Editor Builder
17-
/// =======================================================
17+
/// ============================================================================
1818
///
1919
/// This code uses [dist](https://opensource.axo.dev/cargo-dist/book/) as a part
2020
/// of the release process. To update the `./release.yaml` file this tool
2121
/// creates:
2222
///
23-
/// 1. Edit `server/dist-workspace.toml`: change `allow-dirty` to `[]`.
24-
/// 2. Run `dist init` and accept the defaults, then run `dist generate`.
25-
/// 3. Review changes to `./release.yaml`, reapplying hand edits.
26-
/// 4. Revert the changes to `server/dist-workspace.toml`.
27-
/// 5. Test
23+
/// 1. Edit `server/dist-workspace.toml`: change `allow-dirty` to `[]`.
24+
/// 2. Run `dist init` and accept the defaults, then run `dist generate`.
25+
/// 3. Review changes to `./release.yaml`, reapplying hand edits.
26+
/// 4. Revert the changes to `server/dist-workspace.toml`.
27+
/// 5. Test
2828
// Imports
29-
// -------
29+
// -----------------------------------------------------------------------------
3030
//
3131
// ### Standard library
3232
use std::{
@@ -50,7 +50,7 @@ use regex::Regex;
5050
// None
5151
//
5252
// Data structures
53-
// ---------------
53+
// -----------------------------------------------------------------------------
5454
//
5555
// The following defines the command-line interface for the CodeChat Editor.
5656
#[derive(Parser)]
@@ -117,15 +117,15 @@ struct TypeScriptBuildOptions {
117117
}
118118

119119
// Constants
120-
// ---------
120+
// -----------------------------------------------------------------------------
121121
static VSCODE_PATH: &str = "../extensions/VSCode";
122122
static CLIENT_PATH: &str = "../client";
123123
static BUILDER_PATH: &str = "../builder";
124124
static TEST_UTILS_PATH: &str = "../test_utils";
125125
static NAPI_TARGET: &str = "NAPI_TARGET";
126126

127127
// Code
128-
// ----
128+
// -----------------------------------------------------------------------------
129129
//
130130
// ### Utilities
131131
//
@@ -242,8 +242,8 @@ fn quick_copy_dir<P: AsRef<Path>>(src: P, dest: P, files: Option<P>) -> io::Resu
242242
.status()?
243243
.code()
244244
.expect("Copy process terminated by signal");
245-
// Per [these
246-
// docs](https://learn.microsoft.com/en-us/troubleshoot/windows-server/backup-and-storage/return-codes-used-robocopy-utility),
245+
// Per
246+
// [these docs](https://learn.microsoft.com/en-us/troubleshoot/windows-server/backup-and-storage/return-codes-used-robocopy-utility),
247247
// check the return code.
248248
if cfg!(windows) && exit_code >= 8 || !cfg!(windows) && exit_code != 0 {
249249
Err(io::Error::other(format!(
@@ -288,7 +288,7 @@ fn search_and_replace_file<
288288
}
289289

290290
// Core routines
291-
// -------------
291+
// -----------------------------------------------------------------------------
292292
//
293293
// These functions simplify common build-focused development tasks and support
294294
// CI builds.
@@ -312,17 +312,17 @@ fn patch_file(patch: &str, before_patch: &str, file_path: &str) -> io::Result<()
312312
}
313313
/// After updating files in the client's Node files, perform some fix-ups.
314314
fn patch_client_libs() -> io::Result<()> {
315-
// Apply a the fixes described in [issue
316-
// 27](https://github.com/bjones1/CodeChat_Editor/issues/27).
315+
// Apply a the fixes described in
316+
// [issue 27](https://github.com/bjones1/CodeChat_Editor/issues/27).
317317
patch_file(
318318
"
319319
selectionNotFocus = this.view.state.facet(editable) ? focused : hasSelection(this.dom, this.view.observer.selectionRange)",
320320
" let selectionNotFocus = !focused && !(this.view.state.facet(editable) || this.dom.tabIndex > -1) &&
321321
hasSelection(this.dom, this.view.observer.selectionRange) && !(activeElt && this.dom.contains(activeElt));",
322322
&format!("{CLIENT_PATH}/node_modules/@codemirror/view/dist/index.js")
323323
)?;
324-
// In [older
325-
// releases](https://www.tiny.cloud/docs/tinymce/5/6.0-upcoming-changes/#options),
324+
// In
325+
// [older releases](https://www.tiny.cloud/docs/tinymce/5/6.0-upcoming-changes/#options),
326326
// TinyMCE allowed users to change `whitespace_elements`; the whitespace
327327
// inside these isn't removed by TinyMCE. However, this was removed in v6.0.
328328
// Therefore, manually patch TinyMCE instead.
@@ -385,8 +385,8 @@ fn run_install(dev: bool) -> io::Result<()> {
385385
#[cfg(not(windows))]
386386
// The original command had `'=https'`, but single quotes confused
387387
// `cmd_lib` and aren't needed to quote this. Note that `//` in the URL
388-
// is a comment in Rust, so it must be [enclosed in
389-
// quotes](https://github.com/rust-shell-script/rust_cmd_lib/issues/88).
388+
// is a comment in Rust, so it must be
389+
// [enclosed in quotes](https://github.com/rust-shell-script/rust_cmd_lib/issues/88).
390390
run_cmd! {
391391
curl -L --proto =https --tlsv1.2 -sSf "https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh" | bash;
392392
}?;
@@ -560,7 +560,7 @@ fn run_client_build(
560560
true,
561561
)?;
562562

563-
// <a id="#pdf.js>The PDF viewer for use with VSCode. Built it separately,
563+
// \<a id="#pdf.js>The PDF viewer for use with VSCode. Built it separately,
564564
// since it's loaded apart from the rest of the Client.
565565
run_script(
566566
&esbuild,
@@ -643,7 +643,8 @@ fn run_extensions_build(
643643
if dist {
644644
napi_args.push("--release");
645645
}
646-
// See if this is a cross-platform build -- if so, add in the specified target.
646+
// See if this is a cross-platform build -- if so, add in the specified
647+
// target.
647648
let target;
648649
if let Ok(tmp) = env::var(NAPI_TARGET) {
649650
target = tmp;
@@ -739,7 +740,9 @@ fn run_postrelease(target: &str) -> io::Result<()> {
739740
"aarch64-apple-darwin" => "darwin-arm64",
740741
_ => panic!("Unsupported platform {target}."),
741742
};
742-
// `vsce` will invoke this program's `ext_build`; however, it doesn't provide a way to pass the target when cross-compiling. Use an environment variable instead.
743+
// `vsce` will invoke this program's `ext_build`; however, it doesn't
744+
// provide a way to pass the target when cross-compiling. Use an environment
745+
// variable instead.
743746
unsafe {
744747
env::set_var(NAPI_TARGET, target);
745748
}
@@ -763,7 +766,7 @@ fn run_postrelease(target: &str) -> io::Result<()> {
763766
}
764767

765768
// CLI implementation
766-
// ------------------
769+
// -----------------------------------------------------------------------------
767770
//
768771
// The following code implements the command-line interface for the CodeChat
769772
// Editor.

client/src/CodeChatEditor-test.mts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@
1515
// [http://www.gnu.org/licenses](http://www.gnu.org/licenses).
1616
//
1717
// `CodeChatEditor-test.mts` -- Tests for the CodeChat Editor client
18-
// =================================================================
18+
// =============================================================================
1919
//
2020
// To run tests, add a `?test` to any web page served by the CodeChat Editor
2121
// server.
2222
//
2323
// Imports
24-
// -------
24+
// -----------------------------------------------------------------------------
2525
import { assert } from "chai";
2626
import "mocha/mocha.js";
2727
import "mocha/mocha.css";
@@ -44,7 +44,7 @@ import {
4444
const sleep = (ms: number) => new Promise((r) => setTimeout(r, ms));
4545

4646
// Tests
47-
// -----
47+
// -----------------------------------------------------------------------------
4848
//
4949
// <a id="CodeChatEditor_test"></a>Defining this global variable signals the
5050
// CodeChat Editor to [run tests](CodeChatEditor.mts#CodeChatEditor_test).

client/src/CodeChatEditor.mts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,9 @@ const _open_lp = async (
253253
(
254254
event: EditorEvent<Events.EditorEventMap["dirty"]>,
255255
) => {
256-
// Sometimes, `tinymce.activeEditor` is null (perhaps when it's not focused). Use the `event` data instead.
256+
// Sometimes, `tinymce.activeEditor` is null
257+
// (perhaps when it's not focused). Use the `event`
258+
// data instead.
257259
event.target.setDirty(false);
258260
is_dirty = true;
259261
startAutosaveTimer();
@@ -320,7 +322,8 @@ const save_lp = (is_dirty: boolean) => {
320322
) as HTMLDivElement;
321323
mathJaxUnTypeset(codechat_body);
322324
// To save a document only, simply get the HTML from the only Tiny
323-
// MCE div. Update the `doc_contents` to stay in sync with the Server.
325+
// MCE div. Update the `doc_contents` to stay in sync with the
326+
// Server.
324327
doc_content = tinymce.activeEditor!.save();
325328
(
326329
code_mirror_diffable as {
@@ -368,7 +371,9 @@ export const saveSelection = () => {
368371
(!(current_node as Element).classList.contains(
369372
"CodeChat-doc-contents",
370373
) &&
371-
// Sometimes, the parent of a custom node (`wc-mermaid`) skips the TinyMCE div and returns the overall div. I don't know why.
374+
// Sometimes, the parent of a custom node (`wc-mermaid`) skips
375+
// the TinyMCE div and returns the overall div. I don't know
376+
// why.
372377
!(current_node as Element).classList.contains("CodeChat-doc"));
373378
current_node = current_node.parentNode!, is_first = false
374379
) {
@@ -380,7 +385,8 @@ export const saveSelection = () => {
380385
// `childNodes` change based on whether text nodes (such as a
381386
// newline) are included are not after tinyMCE parses the content.
382387
const p = current_node.parentNode;
383-
// In case we go off the rails, give up if there are no more parents.
388+
// In case we go off the rails, give up if there are no more
389+
// parents.
384390
if (p === null) {
385391
return {
386392
selection_path: [],

client/src/HashReader.mts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
// [http://www.gnu.org/licenses](http://www.gnu.org/licenses).
1616
//
1717
// `HashReader.mts` -- post-process esbuild output
18-
// ===============================================
18+
// =============================================================================
1919
//
2020
// This script reads the output produced by esbuild to determine the location of
2121
// the bundled files, which have hashes in their file names. It writes these

client/src/assert.mts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
1+
// Copyright (C) 2025 Bryan A. Jones.
2+
//
3+
// This file is part of the CodeChat Editor. The CodeChat Editor is free
4+
// software: you can redistribute it and/or modify it under the terms of the GNU
5+
// General Public License as published by the Free Software Foundation, either
6+
// version 3 of the License, or (at your option) any later version.
7+
//
8+
// The CodeChat Editor is distributed in the hope that it will be useful, but
9+
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10+
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
11+
// details.
12+
//
13+
// You should have received a copy of the GNU General Public License along with
14+
// the CodeChat Editor. If not, see
15+
// [http://www.gnu.org/licenses](http://www.gnu.org/licenses).
16+
//
117
// `assert.mts`
2-
// ============
18+
// =============================================================================
319
//
420
// Provide a simple `assert` function to check conditions at runtime. Using
521
// things like [assert](https://nodejs.org/api/assert.html) causes problems --

client/src/css/CodeChatEditorProject.css

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
[http://www.gnu.org/licenses/](http://www.gnu.org/licenses/).
1818
1919
`CodeChatEditorProject.css` -- Styles for the CodeChat Editor for projects
20-
==========================================================================
20+
=============================================================================
2121
22-
This is used only to store a reused variable value. See the [CSS
23-
docs](https://drafts.csswg.org/css-variables/). */
22+
This is used only to store a reused variable value. See the
23+
[CSS docs](https://drafts.csswg.org/css-variables/). */
2424
:root {
2525
--sidebar-width: 15rem;
2626
--body-padding: 0.2rem;

client/src/graphviz-webcomponent-setup.mts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@
1515
// [http://www.gnu.org/licenses](http://www.gnu.org/licenses).
1616
//
1717
// `graphviz-webcomponent-setup.mts` -- Configure graphviz webcomponent options
18-
// ============================================================================
18+
// =============================================================================
1919
//
2020
// Configure the Graphviz web component to load the (large) renderer only when a
2121
// Graphviz web component is found on a page. See the
2222
// [docs](https://github.com/prantlf/graphviz-webcomponent#configuration).
2323
//
2424
// Note that this must be in a separate module which is imported before the
25-
// graphviz webcomponent; see the [ESBuild
26-
// docs](https://esbuild.github.io/content-types/#real-esm-imports).
25+
// graphviz webcomponent; see the
26+
// [ESBuild docs](https://esbuild.github.io/content-types/#real-esm-imports).
2727
/*eslint-disable-next-line @typescript-eslint/no-explicit-any */
2828
(window as any).graphvizWebComponent = {
2929
rendererUrl: "/static/bundled/renderer.js",

client/src/shared_types.mts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,18 @@
1414
// the CodeChat Editor. If not, see
1515
// [http://www.gnu.org/licenses](http://www.gnu.org/licenses).
1616
//
17-
// `shared_types.mts` -- Shared type definitions
18-
// =============================================
19-
// The time, in ms, to wait between the last user edit and sending updated data to the Server.
17+
// `shared_types.mts` -- Shared type definitionsz
18+
// =============================================================================
19+
//
20+
// The time, in ms, to wait between the last user edit and sending updated data
21+
// to the Server.
2022
export const autosave_timeout_ms = 300;
2123

22-
// Produce a whole random number. Fractional numbers aren't consistently converted to the same number. Note that the mantissa of a JavaScript `Number` is 53 bits per the [docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number#number_encoding). To be certain, also round the result.
24+
// Produce a whole random number. Fractional numbers aren't consistently
25+
// converted to the same number. Note that the mantissa of a JavaScript `Number`
26+
// is 53 bits per the
27+
// [docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number#number_encoding).
28+
// To be certain, also round the result.
2329
export const rand = () => Math.round(Math.random() * 2 ** 53);
2430

2531
// ### Message types
@@ -41,7 +47,8 @@ import { ResultErrTypes } from "./rust-types/ResultErrTypes.js";
4147
// Manually define this, since `ts-rs` can't export `webserver.MessageResult`.
4248
type MessageResult = { Ok: ResultOkTypes } | { Err: ResultErrTypes };
4349

44-
// Modified from [SO](https://stackoverflow.com/a/79050131). If the value is a string, use it; otherwise, assume it's a dict and use its key.
50+
// Modified from [SO](https://stackoverflow.com/a/79050131). If the value is a
51+
// string, use it; otherwise, assume it's a dict and use its key.
4552
type KeysOfRustEnum<T> = T extends T ? (T extends string ? T : keyof T) : never;
4653

4754
export type {

client/src/tinymce-config.mts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ import {
2525
RawEditorOptions,
2626
TinyMCE,
2727
} from "tinymce";
28-
// This is taken from the [TinyMCE example code](https://github.com/tinymce/tinymce/blob/main/modules/tinymce/src/core/demo/ts/demo/TinyMceDemo.ts). However, esbuild doesn't accept it.
28+
// This is taken from the
29+
// [TinyMCE example code](https://github.com/tinymce/tinymce/blob/main/modules/tinymce/src/core/demo/ts/demo/TinyMceDemo.ts).
30+
// However, esbuild doesn't accept it.
2931
//export declare const tinymce: TinyMCE;
3032
// Here's a workaround.
3133
export const tinymce = tinymce_ as unknown as TinyMCE;

0 commit comments

Comments
 (0)