| # Contributing to Chahuadev Markdown Presenter | |
| First off, thank you for considering contributing to Chahuadev Markdown Presenter! It's people like you that make this project such a great tool. | |
| [English](#english) | [ไทย](#thai) | |
| --- | |
| ## English | |
| ### Code of Conduct | |
| This project and everyone participating in it is governed by our [Code of Conduct](CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code. | |
| ### How Can I Contribute? | |
| #### Reporting Bugs | |
| Before creating bug reports, please check the [existing issues](https://github.com/chahuadev/chahuadev-markdown-presenter/issues) to avoid duplicates. | |
| **When you create a bug report, please include:** | |
| - **Clear title and description** | |
| - **Steps to reproduce** the issue | |
| - **Expected behavior** vs **actual behavior** | |
| - **Screenshots** if applicable | |
| - **Environment details**: | |
| - OS version (Windows/macOS/Linux) | |
| - Node.js version (`node --version`) | |
| - Electron version | |
| - Application version | |
| **Example bug report:** | |
| ```markdown | |
| **Title:** Auto-pagination fails with code blocks over 10 lines | |
| **Description:** | |
| When a Markdown file contains a code block with more than 10 lines, | |
| the auto-pagination system crashes. | |
| **Steps to Reproduce:** | |
| 1. Create a markdown file with a code block > 10 lines | |
| 2. Click "Sync Markdown" | |
| 3. Observe error in console | |
| **Expected:** | |
| Code block should be split across multiple slides | |
| **Actual:** | |
| Application crashes with TypeError | |
| **Environment:** | |
| - OS: Windows 11 | |
| - Node: v18.16.0 | |
| - Electron: 28.0.0 | |
| ``` | |
| #### Suggesting Enhancements | |
| Enhancement suggestions are tracked as GitHub issues. When creating an enhancement suggestion: | |
| - **Use a clear and descriptive title** | |
| - **Provide detailed description** of the suggested enhancement | |
| - **Explain why this enhancement would be useful** | |
| - **List alternative solutions** you've considered | |
| #### Pull Requests | |
| **Process:** | |
| 1. **Fork** the repository | |
| 2. **Create a branch** from `main`: | |
| ```bash | |
| git checkout -b feature/your-feature-name | |
| ``` | |
| 3. **Make your changes** with clear commit messages | |
| 4. **Test thoroughly** - ensure all existing functionality works | |
| 5. **Update documentation** if needed | |
| 6. **Submit a pull request** with: | |
| - Clear description of changes | |
| - Reference to related issues | |
| - Screenshots/GIFs for UI changes | |
| **Commit Message Guidelines:** | |
| ``` | |
| type(scope): subject | |
| body (optional) | |
| footer (optional) | |
| ``` | |
| **Types:** | |
| - `feat`: New feature | |
| - `fix`: Bug fix | |
| - `docs`: Documentation changes | |
| - `style`: Code style changes (formatting, semicolons, etc.) | |
| - `refactor`: Code refactoring | |
| - `test`: Adding or updating tests | |
| - `chore`: Maintenance tasks | |
| **Examples:** | |
| ``` | |
| feat(pagination): add configurable max lines per slide | |
| fix(parser): handle empty code blocks correctly | |
| docs(readme): update installation instructions | |
| ``` | |
| ### Development Setup | |
| #### Prerequisites | |
| - Node.js 18.0.0+ | |
| - npm 8.0.0+ | |
| - Git | |
| #### Getting Started | |
| ```bash | |
| # Clone your fork | |
| git clone https://github.com/YOUR_USERNAME/chahuadev-markdown-presenter.git | |
| # Navigate to directory | |
| cd chahuadev-markdown-presenter | |
| # Add upstream remote | |
| git remote add upstream https://github.com/chahuadev/chahuadev-markdown-presenter.git | |
| # Install dependencies | |
| npm install | |
| # Start development | |
| npm start | |
| ``` | |
| #### Project Structure | |
| ``` | |
| src/ | |
| ├── main/ # Electron main process | |
| ├── renderer/ # UI and frontend logic | |
| └── shared/ # Shared modules (parser, paginator, etc.) | |
| ``` | |
| #### Key Files | |
| - **`src/shared/markdown-parser.js`** - Markdown parsing logic | |
| - **`src/shared/slide-paginator.js`** - Auto-pagination algorithm | |
| - **`src/renderer/js/app.js`** - Main application controller | |
| - **`src/renderer/js/video-renderer.js`** - Video export logic | |
| ### Coding Standards | |
| #### JavaScript Style | |
| - Use **ES6+ features** (const/let, arrow functions, template literals) | |
| - Use **ES Modules** (`import`/`export`) | |
| - **2 spaces** for indentation | |
| - **Semicolons** required | |
| - **Single quotes** for strings (except template literals) | |
| #### Code Comments | |
| ```javascript | |
| /** | |
| * Calculate visual lines for a content item | |
| * @param {Object} item - Content item with type and content | |
| * @returns {number} Number of visual lines | |
| */ | |
| export function calculateVisualLines(item) { | |
| // Implementation | |
| } | |
| ``` | |
| #### Error Handling | |
| ```javascript | |
| try { | |
| const result = await parseMarkdown(content); | |
| return result; | |
| } catch (error) { | |
| console.error('Failed to parse markdown:', error); | |
| throw new Error(`Markdown parsing failed: ${error.message}`); | |
| } | |
| ``` | |
| ### Testing | |
| ```bash | |
| # Run tests (when implemented) | |
| npm test | |
| # Run linter | |
| npm run lint | |
| ``` | |
| **Test Guidelines:** | |
| - Write unit tests for new features | |
| - Ensure tests pass before submitting PR | |
| - Include test cases for edge cases | |
| ### Documentation | |
| When adding new features: | |
| 1. **Update relevant documentation** in `docs/` | |
| 2. **Add examples** to demonstrate usage | |
| 3. **Update README.md** if user-facing changes | |
| 4. **Write bilingual docs** (EN + TH) when possible | |
| ### Questions? | |
| - Open an issue with the `question` label | |
| - Join discussions in existing issues | |
| - Check [documentation](docs/) first | |
| --- | |
| ## Thai | |
| ### จรรยาบรรณ | |
| โปรเจกต์นี้และทุกคนที่เข้าร่วมอยู่ภายใต้ [จรรยาบรรณ](CODE_OF_CONDUCT.md) ของเรา การเข้าร่วมหมายความว่าคุณยอมรับจรรยาบรรณนี้ | |
| ### ฉันสามารถมีส่วนร่วมได้อย่างไร? | |
| #### รายงานบั๊ก | |
| ก่อนสร้างรายงานบั๊ก โปรดตรวจสอบ [issues ที่มีอยู่](https://github.com/chahuadev/chahuadev-markdown-presenter/issues) เพื่อหลีกเลี่ยงการซ้ำซ้อน | |
| **เมื่อสร้างรายงานบั๊ก โปรดระบุ:** | |
| - **หัวข้อและคำอธิบายที่ชัดเจน** | |
| - **ขั้นตอนการทำซ้ำ** ปัญหา | |
| - **พฤติกรรมที่คาดหวัง** กับ **พฤติกรรมจริง** | |
| - **ภาพหน้าจอ** ถ้ามี | |
| - **รายละเอียดสภาพแวดล้อม**: | |
| - เวอร์ชัน OS (Windows/macOS/Linux) | |
| - เวอร์ชัน Node.js (`node --version`) | |
| - เวอร์ชัน Electron | |
| - เวอร์ชันแอปพลิเคชัน | |
| #### แนะนำการปรับปรุง | |
| การแนะนำการปรับปรุงจะถูกติดตามเป็น GitHub issues เมื่อสร้างข้อเสนอแนะ: | |
| - **ใช้หัวข้อที่ชัดเจนและอธิบายได้** | |
| - **ให้คำอธิบายโดยละเอียด** ของการปรับปรุงที่แนะนำ | |
| - **อธิบายว่าทำไมการปรับปรุงนี้มีประโยชน์** | |
| - **แสดงทางเลือกอื่น** ที่คุณพิจารณา | |
| #### Pull Requests | |
| **กระบวนการ:** | |
| 1. **Fork** repository | |
| 2. **สร้าง branch** จาก `main`: | |
| ```bash | |
| git checkout -b feature/ชื่อฟีเจอร์ของคุณ | |
| ``` | |
| 3. **ทำการเปลี่ยนแปลง** พร้อม commit messages ที่ชัดเจน | |
| 4. **ทดสอบอย่างละเอียด** - ตรวจสอบว่าฟังก์ชันทั้งหมดทำงาน | |
| 5. **อัปเดตเอกสาร** ถ้าจำเป็น | |
| 6. **ส่ง pull request** พร้อม: | |
| - คำอธิบายการเปลี่ยนแปลงที่ชัดเจน | |
| - อ้างอิงถึง issues ที่เกี่ยวข้อง | |
| - ภาพหน้าจอ/GIFs สำหรับการเปลี่ยนแปลง UI | |
| **แนวทาง Commit Message:** | |
| ``` | |
| type(scope): เรื่อง | |
| เนื้อหา (ถ้ามี) | |
| footer (ถ้ามี) | |
| ``` | |
| **ประเภท:** | |
| - `feat`: ฟีเจอร์ใหม่ | |
| - `fix`: แก้บั๊ก | |
| - `docs`: เปลี่ยนแปลงเอกสาร | |
| - `style`: เปลี่ยนสไตล์โค้ด (formatting, semicolons, ฯลฯ) | |
| - `refactor`: รีแฟกเตอร์โค้ด | |
| - `test`: เพิ่มหรืออัปเดตเทสต์ | |
| - `chore`: งานบำรุงรักษา | |
| ### การตั้งค่าการพัฒนา | |
| #### ความต้องการเบื้องต้น | |
| - Node.js 18.0.0+ | |
| - npm 8.0.0+ | |
| - Git | |
| #### เริ่มต้น | |
| ```bash | |
| # โคลน fork ของคุณ | |
| git clone https://github.com/YOUR_USERNAME/chahuadev-markdown-presenter.git | |
| # เข้าไปในโฟลเดอร์ | |
| cd chahuadev-markdown-presenter | |
| # เพิ่ม upstream remote | |
| git remote add upstream https://github.com/chahuadev/chahuadev-markdown-presenter.git | |
| # ติดตั้ง dependencies | |
| npm install | |
| # เริ่มพัฒนา | |
| npm start | |
| ``` | |
| ### มาตรฐานการเขียนโค้ด | |
| #### JavaScript Style | |
| - ใช้ **คุณสมบัติ ES6+** (const/let, arrow functions, template literals) | |
| - ใช้ **ES Modules** (`import`/`export`) | |
| - **2 spaces** สำหรับ indentation | |
| - **Semicolons** จำเป็น | |
| - **Single quotes** สำหรับ strings (ยกเว้น template literals) | |
| ### การทดสอบ | |
| ```bash | |
| # รันเทสต์ (เมื่อถูกสร้าง) | |
| npm test | |
| # รัน linter | |
| npm run lint | |
| ``` | |
| ### เอกสาร | |
| เมื่อเพิ่มฟีเจอร์ใหม่: | |
| 1. **อัปเดตเอกสารที่เกี่ยวข้อง** ใน `docs/` | |
| 2. **เพิ่มตัวอย่าง** เพื่อแสดงการใช้งาน | |
| 3. **อัปเดต README.md** ถ้ามีการเปลี่ยนแปลงที่ผู้ใช้เห็น | |
| 4. **เขียนเอกสารสองภาษา** (EN + TH) เมื่อเป็นไปได้ | |
| ### มีคำถาม? | |
| - เปิด issue พร้อมป้ายกำกับ `question` | |
| - เข้าร่วมการสนทนาใน issues ที่มีอยู่ | |
| - ตรวจสอบ [เอกสาร](docs/) ก่อน | |
| --- | |
| Thank you for contributing! 🎉 | |
| ขอบคุณสำหรับการมีส่วนร่วม! 🎉 | |