mirror of
https://github.com/dergigi/boris.git
synced 2025-12-17 22:54:30 +01:00
- Install applesauce-content package for content parsing - Use getParsedContent() to parse nostr content according to applesauce patterns - Create proper TypeScript interfaces for ParsedNode and ParsedContent - Add renderParsedContent() component to render parsed content with proper styling - Handle mentions, links, and text content with appropriate styling - Add CSS styles for nostr-mention and nostr-link classes - Follow applesauce-content documentation patterns for content rendering - Maintain type safety with proper interfaces instead of 'any' types This follows the applesauce-content documentation exactly as shown in the examples, providing proper content parsing and rendering.
applesauce-content
applesauce package for parsing text note content
Example
import { getParsedContent } from "applesauce-content/text";
const stringContent = `
hello nostr!
nostr:npub180cvv07tjdrrgpa0j7j7tmnyl2yr6yr7l8j4s3evf6u64th6gkwsyjh6w6
`;
const ats = getParsedContent(stringContent);
console.log(ats);
/*
{
type: 'root',
event: undefined,
children: [
{ type: 'text', value: 'hello nostr!' },
{ type: 'text', value: '\n' },
{
type: 'mention',
decoded: [Object],
encoded: 'npub180cvv07tjdrrgpa0j7j7tmnyl2yr6yr7l8j4s3evf6u64th6gkwsyjh6w6'
}
]
}
*/