mirror of
https://github.com/amitwh/markdown-converter.git
synced 2026-08-02 10:00:17 +05:30
feat: add document templates library with 10 templates
This commit is contained in:
+11
@@ -3880,6 +3880,17 @@ ipcMain.on('open-table-generator', () => {
|
|||||||
openTableGenerator();
|
openTableGenerator();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// IPC Handler for loading document templates
|
||||||
|
ipcMain.handle('load-template', async (event, filename) => {
|
||||||
|
try {
|
||||||
|
const templatePath = path.join(__dirname, 'templates', filename);
|
||||||
|
return fs.readFileSync(templatePath, 'utf-8');
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Failed to load template:', err);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// IPC Handler for saving pasted/dropped images
|
// IPC Handler for saving pasted/dropped images
|
||||||
ipcMain.handle('save-pasted-image', async (event, { base64, ext }) => {
|
ipcMain.handle('save-pasted-image', async (event, { base64, ext }) => {
|
||||||
try {
|
try {
|
||||||
|
|||||||
+4
-1
@@ -94,7 +94,10 @@ const ALLOWED_SEND_CHANNELS = [
|
|||||||
'insert-generated-content',
|
'insert-generated-content',
|
||||||
|
|
||||||
// Image paste/drop
|
// Image paste/drop
|
||||||
'save-pasted-image'
|
'save-pasted-image',
|
||||||
|
|
||||||
|
// Templates
|
||||||
|
'load-template'
|
||||||
];
|
];
|
||||||
|
|
||||||
const ALLOWED_RECEIVE_CHANNELS = [
|
const ALLOWED_RECEIVE_CHANNELS = [
|
||||||
|
|||||||
+10
-1
@@ -11,6 +11,7 @@ const hljs = require('highlight.js');
|
|||||||
const { createEditor } = require('./editor/codemirror-setup');
|
const { createEditor } = require('./editor/codemirror-setup');
|
||||||
const { undo, redo } = require('@codemirror/commands');
|
const { undo, redo } = require('@codemirror/commands');
|
||||||
const { SidebarManager } = require('./sidebar/sidebar-manager');
|
const { SidebarManager } = require('./sidebar/sidebar-manager');
|
||||||
|
const { renderTemplatesPanel } = require('./sidebar/templates-panel');
|
||||||
const { CommandPalette } = require('./command-palette');
|
const { CommandPalette } = require('./command-palette');
|
||||||
const { PrintPreview } = require('./print-preview');
|
const { PrintPreview } = require('./print-preview');
|
||||||
|
|
||||||
@@ -1109,7 +1110,15 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
});
|
});
|
||||||
sidebarManager.registerPanel('templates', {
|
sidebarManager.registerPanel('templates', {
|
||||||
title: 'Templates',
|
title: 'Templates',
|
||||||
render: (container) => { container.innerHTML = '<p style="color:#888;padding:8px;">Templates coming soon...</p>'; }
|
render: (container) => renderTemplatesPanel(container, async (file) => {
|
||||||
|
const templateContent = await ipcRenderer.invoke('load-template', file);
|
||||||
|
if (templateContent) {
|
||||||
|
const content = templateContent.replace(/\{\{DATE\}\}/g, new Date().toISOString().split('T')[0]);
|
||||||
|
tabManager.createNewTab();
|
||||||
|
const tab = tabManager.tabs.get(tabManager.activeTabId);
|
||||||
|
tabManager.setEditorContent(tab.id, content);
|
||||||
|
}
|
||||||
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
// Image paste handler
|
// Image paste handler
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
const fs = require('fs');
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
|
const templates = [
|
||||||
|
{ name: 'Blog Post', file: 'blog-post.md', description: 'Article with frontmatter' },
|
||||||
|
{ name: 'Meeting Notes', file: 'meeting-notes.md', description: 'Agenda, notes, action items' },
|
||||||
|
{ name: 'Technical Spec', file: 'technical-spec.md', description: 'Requirements and architecture' },
|
||||||
|
{ name: 'Changelog', file: 'changelog.md', description: 'Keep a Changelog format' },
|
||||||
|
{ name: 'README', file: 'readme.md', description: 'Project documentation' },
|
||||||
|
{ name: 'Project Plan', file: 'project-plan.md', description: 'Goals, milestones, timeline' },
|
||||||
|
{ name: 'API Docs', file: 'api-docs.md', description: 'API endpoint documentation' },
|
||||||
|
{ name: 'Tutorial', file: 'tutorial.md', description: 'Step-by-step guide' },
|
||||||
|
{ name: 'Release Notes', file: 'release-notes.md', description: 'Version release summary' },
|
||||||
|
{ name: 'Comparison', file: 'comparison.md', description: 'Feature comparison table' },
|
||||||
|
];
|
||||||
|
|
||||||
|
function renderTemplatesPanel(container, onSelect) {
|
||||||
|
container.innerHTML = `
|
||||||
|
<div class="panel-list">
|
||||||
|
${templates.map(t => `
|
||||||
|
<div class="panel-list-item template-item" data-file="${t.file}">
|
||||||
|
<div class="panel-list-item-title">${t.name}</div>
|
||||||
|
<div class="panel-list-item-desc">${t.description}</div>
|
||||||
|
</div>
|
||||||
|
`).join('')}
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
|
||||||
|
container.querySelectorAll('.template-item').forEach(el => {
|
||||||
|
el.addEventListener('click', () => onSelect(el.dataset.file));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = { renderTemplatesPanel, templates };
|
||||||
@@ -130,3 +130,34 @@ body[class*="dark"] .sidebar-panel-header {
|
|||||||
border-color: #333;
|
border-color: #333;
|
||||||
color: #ccc;
|
color: #ccc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Panel list items (templates, etc.) */
|
||||||
|
.panel-list-item {
|
||||||
|
padding: 10px 12px;
|
||||||
|
border-radius: 6px;
|
||||||
|
cursor: pointer;
|
||||||
|
margin-bottom: 4px;
|
||||||
|
}
|
||||||
|
.panel-list-item:hover {
|
||||||
|
background: var(--gray-200, #e5e7eb);
|
||||||
|
}
|
||||||
|
.panel-list-item-title {
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 500;
|
||||||
|
color: var(--gray-800, #1f2937);
|
||||||
|
}
|
||||||
|
.panel-list-item-desc {
|
||||||
|
font-size: 11px;
|
||||||
|
color: var(--gray-500, #6b7280);
|
||||||
|
margin-top: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
body[class*="dark"] .panel-list-item:hover {
|
||||||
|
background: #333;
|
||||||
|
}
|
||||||
|
body[class*="dark"] .panel-list-item-title {
|
||||||
|
color: #ddd;
|
||||||
|
}
|
||||||
|
body[class*="dark"] .panel-list-item-desc {
|
||||||
|
color: #888;
|
||||||
|
}
|
||||||
|
|||||||
@@ -0,0 +1,90 @@
|
|||||||
|
# API Documentation
|
||||||
|
|
||||||
|
**Base URL:** `https://api.example.com/v1`
|
||||||
|
**Version:** 1.0
|
||||||
|
**Date:** {{DATE}}
|
||||||
|
|
||||||
|
## Authentication
|
||||||
|
|
||||||
|
All requests require an API key in the header:
|
||||||
|
|
||||||
|
```
|
||||||
|
Authorization: Bearer YOUR_API_KEY
|
||||||
|
```
|
||||||
|
|
||||||
|
## Endpoints
|
||||||
|
|
||||||
|
### Get All Resources
|
||||||
|
|
||||||
|
```
|
||||||
|
GET /resources
|
||||||
|
```
|
||||||
|
|
||||||
|
**Query Parameters:**
|
||||||
|
|
||||||
|
| Parameter | Type | Required | Description |
|
||||||
|
|-----------|------|----------|-------------|
|
||||||
|
| page | integer | No | Page number (default: 1) |
|
||||||
|
| limit | integer | No | Items per page (default: 20) |
|
||||||
|
|
||||||
|
**Response:**
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"data": [],
|
||||||
|
"total": 0,
|
||||||
|
"page": 1
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Get Resource by ID
|
||||||
|
|
||||||
|
```
|
||||||
|
GET /resources/:id
|
||||||
|
```
|
||||||
|
|
||||||
|
**Response:**
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"id": "1",
|
||||||
|
"name": "Resource name",
|
||||||
|
"created_at": "2024-01-01T00:00:00Z"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Create Resource
|
||||||
|
|
||||||
|
```
|
||||||
|
POST /resources
|
||||||
|
```
|
||||||
|
|
||||||
|
**Request Body:**
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"name": "New resource",
|
||||||
|
"description": "Description"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Update Resource
|
||||||
|
|
||||||
|
```
|
||||||
|
PUT /resources/:id
|
||||||
|
```
|
||||||
|
|
||||||
|
### Delete Resource
|
||||||
|
|
||||||
|
```
|
||||||
|
DELETE /resources/:id
|
||||||
|
```
|
||||||
|
|
||||||
|
## Error Codes
|
||||||
|
|
||||||
|
| Code | Description |
|
||||||
|
|------|-------------|
|
||||||
|
| 400 | Bad Request |
|
||||||
|
| 401 | Unauthorized |
|
||||||
|
| 404 | Not Found |
|
||||||
|
| 500 | Internal Server Error |
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
---
|
||||||
|
title: Blog Post Title
|
||||||
|
date: {{DATE}}
|
||||||
|
author: Your Name
|
||||||
|
tags: []
|
||||||
|
---
|
||||||
|
|
||||||
|
# Blog Post Title
|
||||||
|
|
||||||
|
## Introduction
|
||||||
|
|
||||||
|
Write your introduction here.
|
||||||
|
|
||||||
|
## Main Content
|
||||||
|
|
||||||
|
Your main content goes here.
|
||||||
|
|
||||||
|
## Conclusion
|
||||||
|
|
||||||
|
Wrap up your thoughts.
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
# Changelog
|
||||||
|
|
||||||
|
## [Unreleased]
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- New feature
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- Updated feature
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- Bug fix
|
||||||
|
|
||||||
|
### Removed
|
||||||
|
- Removed feature
|
||||||
|
|
||||||
|
## [1.0.0] - {{DATE}}
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- Initial release
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
# Comparison: [Option A] vs [Option B]
|
||||||
|
|
||||||
|
**Date:** {{DATE}}
|
||||||
|
**Author:** Your Name
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
|
||||||
|
Brief description of what is being compared and why.
|
||||||
|
|
||||||
|
## Feature Comparison
|
||||||
|
|
||||||
|
| Feature | Option A | Option B |
|
||||||
|
|---------|----------|----------|
|
||||||
|
| Feature 1 | Yes | Yes |
|
||||||
|
| Feature 2 | Yes | No |
|
||||||
|
| Feature 3 | No | Yes |
|
||||||
|
| Feature 4 | Partial | Yes |
|
||||||
|
|
||||||
|
## Pricing
|
||||||
|
|
||||||
|
| Plan | Option A | Option B |
|
||||||
|
|------|----------|----------|
|
||||||
|
| Free | Limited | Limited |
|
||||||
|
| Pro | $10/mo | $15/mo |
|
||||||
|
| Enterprise | Custom | Custom |
|
||||||
|
|
||||||
|
## Pros and Cons
|
||||||
|
|
||||||
|
### Option A
|
||||||
|
|
||||||
|
**Pros:**
|
||||||
|
- Pro 1
|
||||||
|
- Pro 2
|
||||||
|
|
||||||
|
**Cons:**
|
||||||
|
- Con 1
|
||||||
|
- Con 2
|
||||||
|
|
||||||
|
### Option B
|
||||||
|
|
||||||
|
**Pros:**
|
||||||
|
- Pro 1
|
||||||
|
- Pro 2
|
||||||
|
|
||||||
|
**Cons:**
|
||||||
|
- Con 1
|
||||||
|
- Con 2
|
||||||
|
|
||||||
|
## Performance
|
||||||
|
|
||||||
|
| Metric | Option A | Option B |
|
||||||
|
|--------|----------|----------|
|
||||||
|
| Speed | Fast | Moderate |
|
||||||
|
| Memory | Low | Medium |
|
||||||
|
| Scalability | Good | Excellent |
|
||||||
|
|
||||||
|
## Recommendation
|
||||||
|
|
||||||
|
Based on the analysis above, [Option A/B] is recommended for [use case] because [reason].
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
# Meeting Notes
|
||||||
|
|
||||||
|
**Date:** {{DATE}}
|
||||||
|
**Attendees:**
|
||||||
|
- Name 1
|
||||||
|
- Name 2
|
||||||
|
|
||||||
|
## Agenda
|
||||||
|
|
||||||
|
1. Topic 1
|
||||||
|
2. Topic 2
|
||||||
|
|
||||||
|
## Discussion
|
||||||
|
|
||||||
|
### Topic 1
|
||||||
|
|
||||||
|
Notes here.
|
||||||
|
|
||||||
|
## Action Items
|
||||||
|
|
||||||
|
- [ ] Action item 1 — Owner — Due date
|
||||||
|
- [ ] Action item 2 — Owner — Due date
|
||||||
|
|
||||||
|
## Next Meeting
|
||||||
|
|
||||||
|
Date: TBD
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
# Project Plan: [Project Name]
|
||||||
|
|
||||||
|
**Date:** {{DATE}}
|
||||||
|
**Project Lead:** Your Name
|
||||||
|
**Status:** Planning
|
||||||
|
|
||||||
|
## Goals
|
||||||
|
|
||||||
|
1. Primary goal
|
||||||
|
2. Secondary goal
|
||||||
|
|
||||||
|
## Scope
|
||||||
|
|
||||||
|
### In Scope
|
||||||
|
- Item 1
|
||||||
|
- Item 2
|
||||||
|
|
||||||
|
### Out of Scope
|
||||||
|
- Item 1
|
||||||
|
|
||||||
|
## Milestones
|
||||||
|
|
||||||
|
| Milestone | Target Date | Status |
|
||||||
|
|-----------|-------------|--------|
|
||||||
|
| Kickoff | {{DATE}} | Not Started |
|
||||||
|
| MVP | TBD | Not Started |
|
||||||
|
| Launch | TBD | Not Started |
|
||||||
|
|
||||||
|
## Resources
|
||||||
|
|
||||||
|
| Role | Person | Allocation |
|
||||||
|
|------|--------|------------|
|
||||||
|
| Lead | Name | 100% |
|
||||||
|
| Developer | Name | 50% |
|
||||||
|
|
||||||
|
## Risks
|
||||||
|
|
||||||
|
| Risk | Impact | Likelihood | Mitigation |
|
||||||
|
|------|--------|------------|------------|
|
||||||
|
| Risk 1 | High | Medium | Plan |
|
||||||
|
|
||||||
|
## Timeline
|
||||||
|
|
||||||
|
### Phase 1: Planning
|
||||||
|
- [ ] Define requirements
|
||||||
|
- [ ] Create design documents
|
||||||
|
|
||||||
|
### Phase 2: Development
|
||||||
|
- [ ] Implement core features
|
||||||
|
- [ ] Write tests
|
||||||
|
|
||||||
|
### Phase 3: Launch
|
||||||
|
- [ ] Deploy to production
|
||||||
|
- [ ] Monitor and iterate
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
# Project Name
|
||||||
|
|
||||||
|
Brief description of the project.
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
- Feature 1
|
||||||
|
- Feature 2
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm install project-name
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
const project = require('project-name');
|
||||||
|
```
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
| Option | Default | Description |
|
||||||
|
|--------|---------|-------------|
|
||||||
|
| option1 | true | Description |
|
||||||
|
|
||||||
|
## Contributing
|
||||||
|
|
||||||
|
1. Fork the repository
|
||||||
|
2. Create your feature branch
|
||||||
|
3. Commit your changes
|
||||||
|
4. Push to the branch
|
||||||
|
5. Open a Pull Request
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
MIT
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
# Release Notes - v1.0.0
|
||||||
|
|
||||||
|
**Release Date:** {{DATE}}
|
||||||
|
|
||||||
|
## Highlights
|
||||||
|
|
||||||
|
Brief summary of the most important changes in this release.
|
||||||
|
|
||||||
|
## New Features
|
||||||
|
|
||||||
|
- **Feature 1:** Description of the new feature
|
||||||
|
- **Feature 2:** Description of the new feature
|
||||||
|
|
||||||
|
## Improvements
|
||||||
|
|
||||||
|
- Improved performance of feature X
|
||||||
|
- Updated dependency Y to version Z
|
||||||
|
|
||||||
|
## Bug Fixes
|
||||||
|
|
||||||
|
- Fixed issue where X would cause Y (#123)
|
||||||
|
- Resolved crash when performing Z (#456)
|
||||||
|
|
||||||
|
## Breaking Changes
|
||||||
|
|
||||||
|
- Changed API endpoint from `/old` to `/new`
|
||||||
|
- Removed deprecated method `oldMethod()`
|
||||||
|
|
||||||
|
## Migration Guide
|
||||||
|
|
||||||
|
### From v0.9.x to v1.0.0
|
||||||
|
|
||||||
|
1. Update configuration file format
|
||||||
|
2. Replace deprecated API calls
|
||||||
|
|
||||||
|
## Known Issues
|
||||||
|
|
||||||
|
- Issue description (#789)
|
||||||
|
|
||||||
|
## Contributors
|
||||||
|
|
||||||
|
Thanks to everyone who contributed to this release.
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
# Technical Specification: [Feature Name]
|
||||||
|
|
||||||
|
**Version:** 1.0
|
||||||
|
**Date:** {{DATE}}
|
||||||
|
**Author:** Your Name
|
||||||
|
**Status:** Draft
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
|
||||||
|
Brief description of what this feature does.
|
||||||
|
|
||||||
|
## Requirements
|
||||||
|
|
||||||
|
### Functional Requirements
|
||||||
|
1. Requirement 1
|
||||||
|
2. Requirement 2
|
||||||
|
|
||||||
|
### Non-Functional Requirements
|
||||||
|
1. Performance requirement
|
||||||
|
2. Security requirement
|
||||||
|
|
||||||
|
## Architecture
|
||||||
|
|
||||||
|
Describe the technical approach.
|
||||||
|
|
||||||
|
## API Design
|
||||||
|
|
||||||
|
### Endpoints
|
||||||
|
|
||||||
|
| Method | Path | Description |
|
||||||
|
|--------|------|-------------|
|
||||||
|
| GET | /api/resource | Get resource |
|
||||||
|
|
||||||
|
## Testing Strategy
|
||||||
|
|
||||||
|
Describe how this will be tested.
|
||||||
|
|
||||||
|
## Timeline
|
||||||
|
|
||||||
|
| Phase | Duration | Deliverables |
|
||||||
|
|-------|----------|-------------|
|
||||||
|
| Phase 1 | 1 week | Core implementation |
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
# Tutorial: [Topic Name]
|
||||||
|
|
||||||
|
**Date:** {{DATE}}
|
||||||
|
**Difficulty:** Beginner / Intermediate / Advanced
|
||||||
|
**Time:** ~30 minutes
|
||||||
|
|
||||||
|
## Prerequisites
|
||||||
|
|
||||||
|
- Prerequisite 1
|
||||||
|
- Prerequisite 2
|
||||||
|
|
||||||
|
## What You Will Learn
|
||||||
|
|
||||||
|
- Learning objective 1
|
||||||
|
- Learning objective 2
|
||||||
|
|
||||||
|
## Step 1: Getting Started
|
||||||
|
|
||||||
|
Description of the first step.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Example command
|
||||||
|
echo "Hello, World!"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Step 2: Core Concepts
|
||||||
|
|
||||||
|
Explain the main concepts here.
|
||||||
|
|
||||||
|
### Key Concept A
|
||||||
|
|
||||||
|
Details about concept A.
|
||||||
|
|
||||||
|
### Key Concept B
|
||||||
|
|
||||||
|
Details about concept B.
|
||||||
|
|
||||||
|
## Step 3: Building the Feature
|
||||||
|
|
||||||
|
Walk through the implementation.
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
// Example code
|
||||||
|
function example() {
|
||||||
|
return 'Hello';
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Step 4: Testing
|
||||||
|
|
||||||
|
How to verify everything works.
|
||||||
|
|
||||||
|
## Common Issues
|
||||||
|
|
||||||
|
### Issue 1
|
||||||
|
**Problem:** Description of the problem.
|
||||||
|
**Solution:** How to fix it.
|
||||||
|
|
||||||
|
### Issue 2
|
||||||
|
**Problem:** Description of the problem.
|
||||||
|
**Solution:** How to fix it.
|
||||||
|
|
||||||
|
## Next Steps
|
||||||
|
|
||||||
|
- Suggested follow-up 1
|
||||||
|
- Suggested follow-up 2
|
||||||
|
|
||||||
|
## Resources
|
||||||
|
|
||||||
|
- [Resource 1](https://example.com)
|
||||||
|
- [Resource 2](https://example.com)
|
||||||
Reference in New Issue
Block a user