The World's First AI-Powered Markdown Editor Named Stylish
It may not be the first AI-powered markdown editor, but this artisinal application coded in Python, Flask, JavaScript, and CSS/HTML definitely exists. This is a local web application that uses OpenAI to process and improve markdown articles according to user-defined custom style guides.
- AI-Powered Processing: Stylish uses OpenAI's GPT models to process markdown content
- Custom Style Guides: You can create and manage multiple style guides for different content types
- Content Analysis: Analyze content for style guide compliance without making changes
- Validation: Built-in markdown validation and issue detection finds common issues
- Python 3.8+
- OpenAI API key
- Clone the repository:
git clone https://github.com/KristopherLeads/stylish
cd stylish
# If using MacOS Github desktop, a better command is likely: cd Documents/Github/Stylish
- Create a virtual environment:
python3 -m venv venv
source venv/bin/activate
# On Windows: venv\Scripts\activate - but this was developed on a Mac so caveat emptor
- Install dependencies:
pip install -r requirements.txt
- Set up environment variables:
cp env-example.md .env
nano .env
# Edit .env and add your OpenAI API key and Flask string
- Run the application:
python3 stylish.py
- Open your browser of choice and navigate to
http://127.0.0.1:5000
To turn off the Stylish service, follow these steps:
Ctrl+C # This shuts down the web server
deactivate # This shuts of the emulated environment
Create a .env
file in the project root with the following variables:
OPENAI_API_KEY
: Your OpenAI API key (required)OPENAI_MODEL
: OpenAI model to use (default: gpt-3.5-turbo)SECRET_KEY
: Flask secret key for session securityFLASK_CONFIG
: Set to 'production' for deployment (default: development)
Style guides are stored in the style_guides/
directory as markdown files. You can:
- Create new style guides through the web interface
- Manually add
.md
files to thestyle_guides/
directory - Import existing style guides from other projects
Example style guide structure:
# Technical Writing Style Guide
## Voice and Tone
- Use active voice
- Write clearly and concisely
- Maintain a professional tone
## Formatting
- Use ## for main sections
- Use bullet points for lists
- Include code examples in backticks
- Paste your markdown content in the input area
- Select a style guide from the dropdown
The application provides REST API endpoints:
GET /health
- Health checkGET /api/style-guides
- List available style guidesGET /api/style-guides/<name>
- Get specific style guidePOST /api/style-guides
- Create new style guidePOST /api/process
- Process markdown content
stylish/
├── .env-example
├── README.md
├── stylish.py
├── config.py
├── requirements.txt
├── test_openai.py
├── static/
│ ├── css/
│ │ └── style.css
│ └── js/
│ └── main.js
│ └── images/
│ └── stylish-light.png
├── style_guides/
│ └── default.md
├── templates/
│ ├── base.html
│ └── index.html
└── utils/
├── markdown_processor.py
└── openai_client.py
# Run health check
curl http://127.0.0.1:5000/health
# Test API endpoints
curl -X POST http://127.0.0.1:5000/api/process \
-H "Content-Type: application/json" \
-d '{"markdown_content": "# Test", "style_guide_name": "default", "action": "analyze"}'
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
OpenAI API Key Not Working
- Verify your API key is correct and has sufficient credits
- Check that the key is properly set in your
.env
file - Ensure that in the process of setting up your
.env
file, you correctly copied it and changed the name from.example-env
to.env
OpenAI Issue with Keyword, e.g. Proxies
- This is a known issue - 1.55.3 was tested to work fine and was the version I used for all testing.
- To install 1.55.3, use this command:
pip install openai==1.55.3
Style Guide Not Found
- Ensure the style guide file exists in the
style_guides/
directory - Check that the filename matches exactly
Processing Takes Too Long
- Large content may take longer to process via OpenAI - if you keep failing processing, consider breaking large documents into smaller sections
Memory Issues
- Restart the application if you encounter memory issues