# Contributing to Email.sublime-syntax Thank you for considering contributing to `email.sublime-syntax`! ## Development Setup To test changes live in Sublime Text: 1. Clone or symlink this repository into your Sublime Text `Packages` directory: ```bash ./scripts/link_sublime.sh ``` 2. Open Sublime Text and verify that the package loads. Any changes to `email.sublime-syntax` or `email_plugin.py` will automatically reload. To test changes in `bat`: 1. Run `./scripts/link_bat.sh` to symlink the syntax and rebuild `bat`'s syntax cache: ```bash ./scripts/link_bat.sh ``` ## Testing & Verifying Changes ### 1. Automated Syntax Tests Sublime Text provides an official syntax test runner: - Open `tests/syntax_test_email.eml` in Sublime Text. - Press Cmd + B (macOS) or Ctrl + B (Windows/Linux) to run the test suite. - Sublime Text validates every scope assertion and displays the result panel (`Success: X assertions passed`). ### 2. Visual Verification Open any sample email from the [`mariozaizar/emails`](https://github.com/mariozaizar/emails) fixture corpus under `tests/fixtures/emails/` in Sublime Text or with `bat` (synced from `mariozaizar/emails` releases via `.github/workflows/sync-fixtures.yml` or `./scripts/sync_fixtures.sh`): ```bash bat tests/fixtures/emails/basic/basic_mime.eml ``` ### 3. Inspecting Scopes in Sublime Text Place the cursor over any token in an email file and press: - **macOS**: Cmd + Option + P - **Windows / Linux**: Ctrl + Alt + Shift + P The status bar (or popup) will display the exact scope hierarchy at that character position. ### 4. Testing Plugin Tooltips - **Base64 Tooltip**: Hover your cursor over the Base64 image or text block in `tests/fixtures/emails/basic/basic_mime.eml` (or `tests/fixtures/emails/attachments/image_formats.eml`) to verify the decode popup appears. - **Timestamp Tooltip**: Hover your cursor over the `Date:` header timestamp to verify the local and UTC time conversion popup. ## Guidelines & Best Practices - **Scope Naming**: Follow official [Sublime Text Scope Naming Guidelines](https://www.sublimetext.com/docs/scope_naming.html) to ensure themes and color schemes color tokens accurately and predictably. - **Syntax Compatibility**: Syntax rules must remain compatible across supported Sublime Text builds and `bat` (`syntect`). - **Regular Expressions**: Avoid unbounded quantifier nesting (`(a+)+`) or ambiguous overlapping groups to prevent catastrophic backtracking (ReDoS). ## Code of Conduct This project adheres to the Contributor Covenant Code of Conduct. By participating, you are expected to uphold this code. Please review [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md) for details. ## Security Vulnerabilities If you discover a potential security vulnerability, please do not open a public issue. Refer to our [Security Policy](SECURITY.md) for instructions on confidential disclosure. ## Submitting Pull Requests 1. Create a feature branch from `master`. 2. Keep PRs focused on a single change or fix. 3. Attach **before / after screenshots** illustrating any visual changes in highlighting. 4. Include sample `.eml` snippets in the PR description if introducing syntax rules for new email headers or constructs. 5. Fill out the checklist in the [Pull Request Template](.github/PULL_REQUEST_TEMPLATE.md). ### Pull Request Lifecycle & Review Strategy To keep contribution simple and welcoming for external contributors: - **Focus purely on code & tests**: You do not need to edit `CHANGELOG.md`, `messages.json`, or manage version tags in your PR. - **Clean Merge**: Maintainers review and merge PRs directly into `master` as-is, ensuring contributors retain full commit authorship and GitHub contribution credit. - **Release Tracking**: Maintainers curate `CHANGELOG.md`, credits, and release versions on `master` following merge. ## Release Process For versioning conventions, changelog management, Package Control upgrades, and instructions on creating a release, see [RELEASE.md](RELEASE.md). ## References - [Sublime Text Syntax Documentation](https://www.sublimetext.com/docs/syntax.html) - [Sublime Text Scope Naming Guidelines](https://www.sublimetext.com/docs/scope_naming.html) - [RFC 5322: Internet Message Format](https://tools.ietf.org/html/rfc5322) - [RFC 2045: MIME Part One](https://tools.ietf.org/html/rfc2045) - [RFC 2047: MIME Message Header Extensions for Non-ASCII Text](https://tools.ietf.org/html/rfc2047)