Markdown Editor - By Nikhil
A simple, fast, and secure Markdown Editor application built with React, Vite, Material UI, and Electron. This project allows users to create, edit, and delete markdown notes efficiently. It features a clean user interface, real-time previews for markdown content, and follows best practices for security and performance.
- Create Notes: Add new markdown notes with a click of a button.
- Search Notes: Quickly search through your notes.
- Delete Notes: Remove notes with a confirmation dialog and receive a notification upon successful deletion.
- Real-time Preview: See live markdown rendering while you type.
- Responsive Design: Works smoothly on both desktop and mobile devices.
- Security: The app is built with secure web development practices, such as Content Security Policy (CSP).
- Electron Support: Build a desktop app for Windows, macOS, and Linux.
- Persistent Storage with IndexedDB: Saves your notes locally for offline use, leveraging IndexedDB for storing data.
- Frontend: React.js, Vite, Material-UI, Emotion (Styled Components)
- State Management: React's
useStateanduseEffect - Tools: Vite for fast build and development experience
- UI Components: Material-UI for modern, customizable UI components
- Code Styling: Emotion for styled components
- Electron: Framework for building cross-platform desktop applications
- Storage: IndexedDB for persistent, local storage of markdown notes
Make sure you have the following installed:
-
Clone the repository:
git clone https://github.com/Nikhil012N/markdown-editor.git cd markdown-editor -
Install dependencies:
If you are using npm:
npm installOr, if you are using yarn:
yarn install -
Run the development server:
If you are using npm:
npm run devOr with yarn:
yarn devOpen http://localhost:5173 in your browser to see the application.
-
Build for Desktop (Electron):
To package the app as a desktop application, run the following command:
npm run electron:buildEnsure you have Electron and its dependencies properly set up for this step.
- Creating a Note: Click the "Create" button on the sidebar to add a new note.
- Editing a Note: Click on any note in the sidebar to start editing the content.
- Searching Notes: Use the search bar at the top to filter and find notes by title.
- Deleting a Note: Click the delete icon next to a note, confirm, and it will be removed from the list.
- Viewing Note Details: Click a note to view more details such as title and last edited timestamp.
- Offline Usage: The app stores your notes locally in IndexedDB, allowing you to access your notes even when offline.
/markdown-editor
├── /electron # Electron-specific files for desktop packaging
├── main.js # Main Electron process
├── preload.js # Electron build configuration
├── /src
├── /components
├── Notelist.jsx # List of notes with add, delete, and
search functionality
├── NoteEditor.jsx
├── ErrorBoundary.jsx # Error boundary for handling runtime errors
├── /styles
├── global.css # Global styles and themes
├── App.jsx # Main App component
├── main.jsx # Entry point for the app
├── /public
├── /index.html # The main HTML template
├── package.json # Project metadata and dependencies
├── vite.config.js # Vite configuration
- App.js: The main component that manages the state and renders the core layout.
- NoteList.js: The sidebar containing the list of notes, their search, and delete functionalities.
- ErrorBoundary.js: A component to catch and display errors in a clean manner.
- Electron Files: Contains Electron-specific files for building and packaging the desktop app.
This application is designed with security in mind:
- Content Security Policy (CSP): Prevents cross-site scripting (XSS) attacks by restricting the resources (scripts, images, etc.) that can be loaded.
- Safe Resource Loading: Only loads resources from trusted origins.
- X-Content-Type-Options: Prevents browsers from interpreting files as something else (like a script).
- User Authentication: Allow users to log in and save their notes securely in the cloud.
- Markdown Export: Provide functionality to export markdown notes as .md files.
- Theming: Implement dark/light mode support.
Contributions are welcome! Feel free to open issues or submit pull requests for bug fixes or new features. Here’s how you can contribute:
- Fork this repository.
- Clone your forked repo locally.
- Create a new branch for your feature or fix.
- Push your changes to your forked repository.
- Open a pull request to the main repository.
This project is open source and available under the MIT License.