This file provides guidance to coding agents when working with code in this repository.
Marktone is a Chrome extension that transforms Rich Text input areas on kintone (a Cybozu collaboration platform) into Markdown input areas. It allows users to write comments, posts, and messages using Markdown syntax with support for mentions, emojis, and syntax highlighting.
pnpm run dev- Build and watch for changes during developmentpnpm run build- Build the extension for productionpnpm run package- Create a distributable zip file for the extension
pnpm run test- Run all tests using Vitestpnpm run test path/to/test.test.ts- Run a specific test file
pnpm run typecheck- Run TypeScript type checking without emitting filespnpm run lint- Run both Biome and Prettier linterspnpm run fix- Automatically fix linting issues
pnpm run storybook- Start Storybook for component developmentpnpm run build-storybook- Build static Storybook sitepnpm run chromatic- Run visual regression tests with Chromatic
The project is a Chrome Extension (Manifest V3) with the following key parts:
- Content Script (
src/app/content.tsx) - Injected into kintone pages to replace rich text editors with Markdown editors - Background Service Worker (
src/app/background.ts) - Handles extension lifecycle and storage operations - Content Loader (
public/content-loader.js) - Bootstraps the content script and injects necessary data
- React: UI components for the Markdown editor
- TypeScript: Type-safe development
- Vite: Build tool and bundler
- Vanilla Extract: CSS-in-JS styling
- Marked: Markdown parsing
- DOMPurify: HTML sanitization
- highlight.js: Syntax highlighting for code blocks
- Cybozu/kintone API client in
src/app/kintone/kintone-client.ts - Directory entity caching for user/organization data in
src/app/kintone/directory-entity-cache.ts
- Custom renderer extending marked.js in
src/app/markdown/renderer/marktoneRenderer.ts - Emoji replacement using gemoji in
src/app/markdown/replacer/emoji-replacer.ts - Mention replacement for @-mentions in
src/app/markdown/replacer/mention-replacer.ts
- Main Marktone component in
src/components/Marktone/index.tsx - Uses
@webscopeio/react-textarea-autocompletefor mention suggestions - Storybook stories for component development
- Uses Vite with multiple entry points (content.js and background.js)
- Path alias
@/maps tosrc/directory - Outputs to
dist/directory with specific naming for extension files - CSS extraction configured to output
content.cssfor injection
- Vitest for unit testing with JSDOM environment
- Test setup file at
tests/setup.ts - Tests located alongside source files and in
tests/directory