Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

fix(x-content): leave inline code out of an X Article's spelling check

nirholas6022ea80fa5b
diff --git a/api/_lib/x-content/queue.js b/api/_lib/x-content/queue.js
index 71fc05c6d..81db52921 100644
--- a/api/_lib/x-content/queue.js
+++ b/api/_lib/x-content/queue.js
@@ -56,10 +56,17 @@ export function loadArticle(root, article) {
// items and quotes. Code blocks and tables are left out because they are
// literal samples, not statements. Every number and absolute in it is held to
// the claims ledger and the language rules, the same as a post.
-export function articleProse(root, item) {
+//
+// `inlineCode: false` drops inline code spans too, for the spelling check: a
+// bone name like `mixamorig:LeftArm` is an identifier quoted from a file, not
+// a word the article spells.
+export function articleProse(root, item, { inlineCode = true } = {}) {
if (item?.kind !== 'article' || !item.article?.body) return '';
if (!existsSync(resolve(root, item.article.body))) return '';
- const { blocks } = loadArticle(root, item.article).content_state;
+ const article = inlineCode ? item.article : null;
+ const { blocks } = article
+ ? loadArticle(root, article).content_state
+ : markdownToContentState(readFileSync(resolve(root, item.article.body), 'utf8').replace(/`[^`\n]+`/g, ' '), { articlePath: item.article.body }).content_state;
return blocks.filter((block) => block.type !== 'atomic').map((block) => block.text).filter(Boolean).join('\n');
}
diff --git a/api/_lib/x-content/verify.js b/api/_lib/x-content/verify.js
index 946354643..121bd7f07 100644
--- a/api/_lib/x-content/verify.js
+++ b/api/_lib/x-content/verify.js
@@ -404,7 +404,7 @@ export async function verifyItem(item, { root, glossary = [], env = process.env
// An Article's body is copy too: its words are spell-checked and its links
// resolved, the same as a post's.
const { articleLinks, articleProse } = await import('./queue.js');
- const body = articleProse(root, item);
+ const body = articleProse(root, item, { inlineCode: false });
const texts = [...itemTexts(item), ...(body ? [body] : []), ...articleLinks(root, item)];
const pages = createPageReader();
const checks = [];
diff --git a/tests/x-content.test.js b/tests/x-content.test.js
index 802795fe9..bc2012d06 100644
--- a/tests/x-content.test.js
+++ b/tests/x-content.test.js
@@ -664,6 +664,10 @@ describe('editorial', () => {
const prose = articleProse(dir, { kind: 'article', article: { body: 'data/x-content/articles/a.md' } });
expect(prose).toBe('Opening line with 3 facts.\nA heading\na list item');
expect(articleProse(dir, { kind: 'post' })).toBe('');
+ writeFileSync(join(dir, 'data/x-content/articles/b.md'), 'Bones named `mixamorig:LeftArm` map to one set.\n');
+ const item = { kind: 'article', article: { body: 'data/x-content/articles/b.md' } };
+ expect(articleProse(dir, item)).toBe('Bones named mixamorig:LeftArm map to one set.');
+ expect(articleProse(dir, item, { inlineCode: false })).toBe('Bones named map to one set.');
});
it('reads "world\'s" as an absolute and "worlds" as a plain word', async () => {