Core package for Papyr - a markdown knowledge management system
npm install papyr-core

style=flat)](https://github.com/Ray-kong/papyr-core)style=flat)](https://github.com/Ray-kong/papyr-core)style=flat)](https://github.com/Ray-kong/papyr-core)style=flat)](https://github.com/Ray-kong/papyr-core)style=flat)](https://github.com/Ray-kong/papyr-core)style=flat)](https://github.com/Ray-kong/papyr-core)style=flat)](https://github.com/Ray-kong/papyr-core)style=flat)](https://github.com/Ray-kong/papyr-core)style=flat)](https://github.com/Ray-kong/papyr-core)style=flat)](https://github.com/Ray-kong/papyr-core)style=flat)](https://github.com/Ray-kong/papyr-core)style=flat)](https://github.com/Ray-kong/papyr-core)style=flat)](https://github.com/Ray-kong/papyr-core)style=flat)](https://github.com/Ray-kong/papyr-core)style=flat)](https://github.com/Ray-kong/papyr-core)style=flat)](https://github.com/Ray-kong/papyr-core)style=flat)](https://github.com/Ray-kong/papyr-core)style=flat)](https://github.com/Ray-kong/papyr-core)



A powerful core package for building markdown-based knowledge management systems. Papyr Core provides essential functionality for parsing, analyzing, and managing interconnected markdown documents.
- Markdown Processing: Parse markdown with frontmatter support
- Graph Analysis: Build and analyze document relationships
- Wiki Links: Support for [[wiki-style]] links between documents
- Search: Full-text search with FlexSearch
- Analytics: Document statistics and insights
- Export: JSON export capabilities
- TypeScript: Full TypeScript support with type definitions
``bash`
npm install papyr-core
`typescript
import { PapyrBuilder, PapyrGraph, PapyrAnalytics } from 'papyr-core';
// Build a knowledge base from markdown files
const builder = new PapyrBuilder();
const data = await builder.buildFromDirectory('./notes');
// Analyze the graph
const graph = new PapyrGraph(data.graph);
const analytics = new PapyrAnalytics(data);
// Get insights
console.log('Total notes:', analytics.getTotalNotes());
console.log('Orphaned notes:', analytics.getOrphanedNotes());
console.log('Most linked notes:', analytics.getMostLinkedNotes());
`
- PapyrBuilder: Build knowledge bases from markdown files
- PapyrGraph: Analyze document relationships and graph structure
- PapyrAnalytics: Generate insights and statistics
- PapyrSearch: Full-text search across documents
- PapyrFileProcessor: Process individual markdown files
#### PapyrBuilder
- buildFromDirectory(path: string): Build from a directory of markdown filesbuildFromFiles(files: string[])
- : Build from specific file pathsbuildFromContent(content: string, filename?: string)
- : Build from markdown content
#### PapyrGraph
- getNeighbors(nodeId: string): Get connected documentsgetPath(from: string, to: string)
- : Find path between documentsgetComponents()
- : Get disconnected graph components
#### PapyrAnalytics
- getTotalNotes(): Count total documentsgetOrphanedNotes()
- : Find documents with no connectionsgetMostLinkedNotes(limit?: number)
- : Get most referenced documents
The package supports various configuration options through the builder:
`typescript`
const builder = new PapyrBuilder({
includeFrontmatter: true,
parseWikiLinks: true,
generateGraph: true,
generateSearchIndex: true
});
- Node.js 18+
- pnpm (recommended) or npm
`bashInstall dependencies
pnpm install
$3
`
papyr-core/
├── src/ # Source code
├── tests/ # Test files
├── dist/ # Built output (generated)
├── package.json # Package configuration
├── tsconfig.json # TypeScript configuration
├── vite.config.ts # Build configuration
└── vitest.config.ts # Test configuration
``MIT License - see LICENSE file for details.
- papyr-react: React components for building Papyr UIs
- papyr-cli: Command-line interface for Papyr