ep_table_of_contents 0.4.1 → 0.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/AGENTS.md ADDED
@@ -0,0 +1,76 @@
1
+ # Agent Guide — ep_table_of_contents
2
+
3
+ View a table of contents for your pad.
4
+
5
+ ## Tech stack
6
+
7
+ * Etherpad plugin framework (hooks declared in `ep.json`)
8
+ * EJS templates rendered server-side via `eejsBlock_*` hooks
9
+ * html10n for i18n (`locales/<lang>.json`, `data-l10n-id` in templates)
10
+ * `ep_plugin_helpers` for shared boilerplate
11
+
12
+ ## Project structure
13
+
14
+ ```
15
+ ep_table_of_contents/
16
+ ├── AGENTS.md
17
+ ├── CONTRIBUTING.md
18
+ ├── ep.json
19
+ ├── index.js
20
+ ├── locales/
21
+ │ ├── ar.json
22
+ │ ├── be-tarask.json
23
+ │ ├── bn.json
24
+ │ ├── ca.json
25
+ │ ├── cs.json
26
+ │ ├── cy.json
27
+ │ └── ...
28
+ ├── package.json
29
+ ├── static/
30
+ │ ├── css/
31
+ │ ├── js/
32
+ │ ├── tests/
33
+ ├── templates/
34
+ │ ├── barButton.ejs
35
+ │ ├── toc.ejs
36
+ ├── tests/
37
+ ```
38
+
39
+ ## Helpers used
40
+
41
+ * `pad-toggle` from `ep_plugin_helpers`
42
+ * `pad-toggle-server` from `ep_plugin_helpers`
43
+
44
+
45
+ ## Helpers NOT used
46
+
47
+ _To be audited in the helpers-adoption sweep (Phase 4)._
48
+
49
+
50
+ ## Running tests locally
51
+
52
+ `ep_table_of_contents` runs inside Etherpad's test harness. From an etherpad checkout that has installed this plugin via `pnpm run plugins i --path ../ep_table_of_contents`:
53
+
54
+ ```bash
55
+ # Backend (Mocha) — harness boots its own server
56
+ pnpm --filter ep_etherpad-lite run test
57
+
58
+ # Playwright — needs `pnpm run dev` in a second terminal
59
+ pnpm --filter ep_etherpad-lite run test-ui
60
+ ```
61
+
62
+ ## Standing rules for agent edits
63
+
64
+ * PRs target `main`. Linear commits, no merge commits.
65
+ * Every bug fix includes a regression test in the same commit.
66
+ * All user-facing strings in `locales/`. No hardcoded English in templates.
67
+ * No hardcoded `aria-label` on icon-only controls — etherpad's html10n auto-populates `aria-label` from the localized string when (a) the element has a `data-l10n-id` and (b) no author-supplied `aria-label` is present. Adding a hardcoded English `aria-label` blocks that and leaves it untranslated. (See `etherpad-lite/src/static/js/vendors/html10n.ts:665-678`.)
68
+ * No nested interactive elements (no `<button>` inside `<a>`).
69
+ * LLM/Agent contributions are explicitly welcomed by maintainers.
70
+
71
+ ## Quick reference: hooks declared in `ep.json`
72
+
73
+ * Server: `loadSettings`, `clientVars`, `eejsBlock_scripts`, `eejsBlock_styles`, `eejsBlock_mySettings`, `eejsBlock_padSettings`, `eejsBlock_editorContainerBox`, `eejsBlock_dd_view`, `eejsBlock_editbarMenuRight`
74
+ * Client: `aceEditEvent`, `handleClientMessage_ACCEPT_COMMIT`, `handleClientMessage_NEW_CHANGES`, `handleClientMessage_CLIENT_MESSAGE`, `postAceInit`
75
+
76
+ When adding a hook, register it in both `ep.json` *and* the matching `exports.<hook> = ...` in the JS file.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ep_table_of_contents",
3
- "version": "0.4.1",
3
+ "version": "0.4.3",
4
4
  "description": "View a table of contents for your pad",
5
5
  "author": {
6
6
  "name": "John McLear",
@@ -1,6 +1,6 @@
1
1
  <li data-key="ep_table_of_contents-toggle" data-type="button" onClick="toggleToc();">
2
2
  <a id="ep_table_of_contents-a" data-l10n-id="ep_table_of_contents.toc.title">
3
- <button class="buttonicon buttonicon-insertunorderedlist" aria-label="Table of Contents" data-l10n-id="ep_table_of_contents.toc.title"></button>
3
+ <button class="buttonicon buttonicon-insertunorderedlist" data-l10n-id="ep_table_of_contents.toc.title"></button>
4
4
  </a>
5
5
  </li>
6
6
  <li class="separator"></li>