mnfst 0.5.151 → 0.5.153

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.
@@ -138,6 +138,8 @@ async function loadHighlightCore() {
138
138
  async function registerLanguage(lang) {
139
139
  if (!lang || lang === 'auto') return;
140
140
  const resolved = LANGUAGE_ALIASES[lang] || lang;
141
+ // Plain-text "languages" have no grammar module — never fetch one.
142
+ if (PLAINTEXT_LANGS.has(resolved.toLowerCase())) return;
141
143
  const core = await loadHighlightCore();
142
144
  if (core.listLanguages().includes(resolved)) return;
143
145
  if (langLoadPromises.has(resolved)) return langLoadPromises.get(resolved);
@@ -162,6 +164,9 @@ async function loadHighlightJS(requestedLang = null) {
162
164
  // auto-detect, or a language module load failed) every subsequent
163
165
  // call funnels through it.
164
166
  if (usingFullBundle || hljsFullPromise) return loadHighlightFull();
167
+ // Plain-text blocks need an hljs instance for the (no-op) highlightInto
168
+ // call, but must NOT escalate to the full bundle or fetch a module.
169
+ if (PLAINTEXT_LANGS.has((requestedLang || '').toLowerCase())) return loadHighlightCore();
165
170
  // A per-block call asking for auto-detect → escalate.
166
171
  if (!requestedLang || requestedLang === 'auto') {
167
172
  usingFullBundle = true;
@@ -215,6 +220,14 @@ const LANGUAGE_ALIASES = {
215
220
  sh: 'bash', shell: 'bash', yml: 'yaml', html: 'xml', svg: 'xml'
216
221
  };
217
222
 
223
+ // Languages that mean "render as plain text — no highlighting." hljs ships a
224
+ // trivial `plaintext` grammar, but there's no point loading a module (or
225
+ // auto-detecting) for content the author explicitly marked plain. `txt` in
226
+ // particular has NO module on the CDN — importing it 404s, and the failed
227
+ // import escalates the whole page to the full bundle. Short-circuiting these
228
+ // keeps the lean path intact and skips the network round-trip entirely.
229
+ const PLAINTEXT_LANGS = new Set(['txt', 'text', 'plain', 'plaintext', 'none', 'nohighlight']);
230
+
218
231
  function resolveLanguage(hljs, langAttr) {
219
232
  if (!langAttr || langAttr === 'auto') return null;
220
233
  const lang = LANGUAGE_ALIASES[langAttr] || langAttr;
@@ -310,6 +323,14 @@ const HTML_LIKE_LANGS = new Set(['html', 'xml', 'svg', 'xhtml', 'rss', 'atom']);
310
323
  // language hljs actually used (or null when no highlighting was applied), so
311
324
  // callers can mark the host element accordingly.
312
325
  function highlightInto(codeEl, source, hljs, requestedLang) {
326
+ // Explicit plain text: keep the code-block chrome (hljs base class gives it
327
+ // the background/padding) but apply no token colours and skip auto-detect.
328
+ if (PLAINTEXT_LANGS.has((requestedLang || '').toLowerCase())) {
329
+ codeEl.textContent = source;
330
+ codeEl.className = 'hljs language-plaintext';
331
+ codeEl.dataset.highlighted = 'yes';
332
+ return 'plaintext';
333
+ }
313
334
  const lang = resolveLanguage(hljs, requestedLang);
314
335
  if (lang) {
315
336
  const result = hljs.highlight(source, { language: lang, ignoreIllegals: true });
@@ -3,7 +3,7 @@
3
3
  "manifest.appwrite.data.js": "sha384-00ulLT+GAIuPHA/rRT9p98vYlsyDzkyKXtg86BDQ6FGQa5vVVN+W6kuforniBAsz",
4
4
  "manifest.appwrite.presence.js": "sha384-uxRpx9/Jj0kGtklH5QmUlAzD3zdSvFRfK6bcJQqxl+Bsf5tOo4zgwqJTQgtZoHQP",
5
5
  "manifest.charts.js": "sha384-RuV7gWXt3s+JegxWgDieR/P5U99sbOYWiYHdJGe2uCJjDFU1cPp0mJ1QT55ec9uz",
6
- "manifest.code.js": "sha384-nP6DncLx/UuJtloyVKMCOXwIBAq32DshTb/Lc0vVRBWX7kSbxiBnY5aEyqqvK8Kg",
6
+ "manifest.code.js": "sha384-BJSRJ7txA6fY660qX+SfEEBrEB0dOChHdHI4/9iNGz3rGqohEZdzs7qA3LuR1GJW",
7
7
  "manifest.color.js": "sha384-6Rv3LxyTcZNjrhtayQfqRdCx0uSZ4BiEbgEI98I62eTvp8Aw7LBIoNJ0Je1oktwL",
8
8
  "manifest.colorpicker.js": "sha384-Wqz0ZIbeIi7KarqqqSLsQk+7E/fMaKhb32hrq5/eWzX1yjqMrpPZKH8y+jZ3mfg+",
9
9
  "manifest.combobox.js": "sha384-oGZIgHsizehYUu3m7VrZkwOadrwm5MfAA4PkN0l5W3FU8LHcuSmWn7XLzmt97jfo",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mnfst",
3
- "version": "0.5.151",
3
+ "version": "0.5.153",
4
4
  "private": false,
5
5
  "workspaces": [
6
6
  "templates/starter",