inkpen 0.7.2 → 0.8.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5c4fef3be455d9fd017e9bdda3fb1b33ec1c1a740cc51ce3ba7dee567a6b4ba9
4
- data.tar.gz: 9a7434fe2b8407f244d0de0ee1e2fecb118d51e6c06ae8d27fac08434ac6fcc0
3
+ metadata.gz: d494c04bfb8bd300d7530a7bf25bf25bcb9de03940d05efae4b7000056344ba4
4
+ data.tar.gz: 242089e92a90223d06f5ea5569df0e3cd8653c073705989b0b2c168ef8d9f65b
5
5
  SHA512:
6
- metadata.gz: 5875dd8060a7d79ac6825ac7fca3f0f773226dc3dcada7d7ffb106f2ff2f963b0b8a24492d340d8467cb27cf0243f7a1f3fa2ab76185a8aa88550e29106f44ff
7
- data.tar.gz: a33dc846e60d11f652173d10031f33dd0478b191384d2c18a59b1df3bf158b2dc6ec74c97d57385229e9a5307feb7bb1a6fdf0284b6e9bac0d1075270babb93a
6
+ metadata.gz: 8622c8eec93c586b4e588d830a8f14a1b235a38c1a88269dc4327952586e308898e4ed20b5d2fac9821af1e79c67deb5263a920969c718d3c160caacca5abf91
7
+ data.tar.gz: 6d4efde0df050df0601d615662443887aca6ab7f267c80ad1903cd94db63fd3c9277fe4768246db9d5419b7659c66d0a2cda6f04c5f0141e88dfd3b41bbb3240
data/CLAUDE.md CHANGED
@@ -132,10 +132,70 @@ app/
132
132
 
133
133
  ## Development
134
134
 
135
+ ### Ruby side
136
+
135
137
  ```bash
136
- # Run tests
137
- bundle exec rake test
138
+ bundle install
139
+ bundle exec rake test # Minitest unit tests
140
+ bin/console # IRB with Inkpen loaded
141
+ ```
138
142
 
139
- # Console
140
- bin/console
143
+ ### JavaScript side (since 0.8.0)
144
+
145
+ ```bash
146
+ npm install # installs production deps + esbuild + vitest
147
+ npm test # runs the spec 01 markdown round-trip tests (vitest)
148
+ npm run build # rebuilds app/assets/javascripts/inkpen.bundle.js
149
+ npm run build:check # validates the bundle: parses, has expected
150
+ # exports, contains zero third-party CDN refs
141
151
  ```
152
+
153
+ **The bundle is committed to the repo.** Run `npm run build` after every
154
+ JS change so consumers don't need to install npm.
155
+
156
+ ### Releasing a new version
157
+
158
+ See `02-addons/107-inkpen-docs/docs/release-process.md` for the full
159
+ release runbook. TL;DR:
160
+
161
+ 1. Bump `lib/inkpen/version.rb` + `inkpen.gemspec` (stub line +
162
+ `s.version`).
163
+ 2. `npm run build && npm run build:check && npm test &&
164
+ bundle exec rake test`.
165
+ 3. `bundle exec rake build` → `pkg/inkpen-X.Y.Z.gem`.
166
+ 4. Smoke test in InventList (open Nodepad, confirm zero `esm.sh`
167
+ requests in DevTools).
168
+ 5. Publish (path-pinned / private gemserver / rubygems — see release
169
+ doc).
170
+
171
+ ## Bundle / vendoring (since 0.8.0)
172
+
173
+ `config/importmap.rb` no longer pins to `esm.sh`. All upstream
174
+ dependencies (TipTap@2.10.3, ProseMirror@1.x, lowlight, highlight.js,
175
+ tippy, popperjs, linkifyjs, and three third-party TipTap extensions)
176
+ are vendored into a single ESM bundle at
177
+ `app/assets/javascripts/inkpen.bundle.js` (1.9 MB minified, source map
178
+ beside it).
179
+
180
+ The build entrypoint is `app/assets/javascripts/inkpen/index.js`. The
181
+ bundle preserves `import "inkpen"` as a side-effecting import that
182
+ registers `inkpen--editor`, `inkpen--toolbar`,
183
+ `inkpen--sticky-toolbar` Stimulus controllers on `window.Stimulus`
184
+ (or starts its own Application if the host hasn't already).
185
+
186
+ **Host externals kept out of the bundle** (host provides them):
187
+
188
+ - `@hotwired/stimulus`
189
+ - `@hotwired/turbo-rails`
190
+
191
+ **Why this exists:** three production CDN incidents on 2026-05-14
192
+ caused by importmap pinning to esm.sh. Plan and audit live at
193
+ `02-addons/107-inkpen-docs/plans/05-vendor-bundle-cdn-decoupling.md`.
194
+
195
+ ## Internal planning docs
196
+
197
+ Inkpen has a dedicated planning surface at
198
+ `02-addons/107-inkpen-docs/`. Roadmap, plans, sessions, handoffs,
199
+ audits all live there. Don't recreate that structure here; this gem
200
+ ships its own consumer-facing docs in `docs/` (README, CHANGELOG,
201
+ FEATURES, ROADMAP, MARKDOWN_MODE planning doc, audits).
@@ -5,6 +5,8 @@
5
5
  * Supports frontmatter, tables, task lists, callouts, and custom blocks.
6
6
  */
7
7
 
8
+ import { parseMarkdownToHTMLReal } from "./markdown_parser.js"
9
+
8
10
  // Mark serializers for inline formatting
9
11
  const MARK_SERIALIZERS = {
10
12
  bold: (text) => `**${text}**`,
@@ -74,13 +76,20 @@ export function importFromMarkdown(markdown, schema, options = {}) {
74
76
  // Parse frontmatter if present
75
77
  const { content, frontmatter } = parseFrontmatter(markdown)
76
78
 
77
- // Parse markdown to HTML first (using browser or a simple parser)
78
- const html = parseMarkdownToHTML(content)
79
+ // Parser selection. Default is the legacy regex parser to preserve
80
+ // behavior for existing callers. Pass `options.parser: "real"` to opt
81
+ // into the GFM-correct marked-based parser. Step 6 of spec 01 will flip
82
+ // the default once round-trip fixtures pass.
83
+ const parser = options.parser === "real" ? "real" : "legacy"
84
+ const html = parser === "real"
85
+ ? parseMarkdownToHTMLReal(content)
86
+ : parseMarkdownToHTML(content)
79
87
 
80
88
  // Return structured result
81
89
  return {
82
90
  html,
83
- frontmatter
91
+ frontmatter,
92
+ parser
84
93
  }
85
94
  }
86
95