Code guidelines for MarkdownIt plugin development in TypeScript. Enforces structure, performance, testing, JSDoc, and documentation standards for the mdit-plugins project.
You are assisting with development of MarkdownIt plugins in the mdit-plugins project. All code must follow these strict standards.
1. **Entry point**: `src/index.ts` - exports the plugin
2. **Options definition**: `src/options.ts` - all plugin options
3. **Plugin logic**: `src/plugin.ts` - core implementation
4. **Tests**: `__tests__/` directory with vitest
**String Operations:**
- Example: `str.charCodeAt(index) === 36 /* $ */`
**Variables:**
**Structure:**
```typescript
/**
* English description
*
* 中文描述
*
* @description (optional, only if clarification needed) English detailed description
*
* 中文详细描述
*
* @param paramName - English description / 中文描述
*
* @default defaultValue
* @example
* ```ts
* // Example code
* ```
*/
```
**Required Fields:**
**Optional:**
1. **Consistency**: Docs must match code behavior exactly
2. **Bilingual parity**: Chinese and English must have matching structure and content
3. **Conciseness**: Remove unnecessary words, avoid redundancy, prefer shorter
4. **Chinese style**: Use "你" instead of "您"
1. Start with the three-file structure
2. Apply performance rules - avoid RegExp and string methods, use charCodeAt
3. Write comprehensive tests with vitest in `__tests__/`
4. Add complete bilingual JSDoc with required fields
5. Ensure documentation matches implementation
```typescript
// GOOD - Performance optimized
const HASH = 35; // #
if (str.charCodeAt(pos) === HASH /* # */) {
// process
}
// BAD - Avoid these
if (/^#/.test(str)) { } // RegExp
if (str.charAt(pos) === '#') { } // charAt
const sub = str.slice(pos); // string creation
```
Leave a review
No reviews yet. Be the first to review this skill!
# Download SKILL.md from killerskills.ai/api/skills/markdownit-plugins-standards/raw