Something went wrong. Try again.
Ghost is lightweight headless server that enables Ghost self hosters to bridge to standard.site with ease..
Something went wrong. Try again.
1.2 kB · 30 lines
TypeScript
at main
12345678910111213141516171819202122232425262728293031import { test } from 'node:test';import assert from 'node:assert/strict';
import { ghostPostToRecord, type GhostPostLike } from './transform.js';import { MARKPUB_MARKDOWN_TYPE } from './content-shape.js';
const PUBLICATION_URI = 'at://did:plc:example/site.standard.publication/self';
const basePost: GhostPostLike = { id: '64f0000000000000000000ab', title: 'Hello', slug: 'hello', status: 'published', published_at: '2026-07-06T10:00:00.000Z', html: '<h2>Hi</h2><p>Body text.</p>',};
test('record carries the markpub content member when the post has HTML', () => { const record = ghostPostToRecord(basePost, PUBLICATION_URI, null); const content = record.content as { $type: string; text: { markdown: string } }; assert.equal(content.$type, MARKPUB_MARKDOWN_TYPE); assert.match(content.text.markdown, /## Hi/); // textContent is untouched by this feature — both representations coexist. assert.match(String(record.textContent), /Body text\./);});
test('record omits content when the post has no HTML', () => { const record = ghostPostToRecord({ ...basePost, html: null }, PUBLICATION_URI, null); assert.ok(!('content' in record));});