Contributing
August 12, 2026 ยท View on GitHub
Setup development prerequisites
- Create a Firefox Add-ons (AMO) account
- Install followings:
- WebExtensions enabled Firefox
- Node.js v24.x
- pnpm for package management (monorepo support)
Fork on GitHub
Before you do anything else, login on GitHub and fork this repository
Clone your fork locally
Install Git and clone your forked repository locally.
$ git clone https://github.com/<your-account>/copy-selection-as-markdown.git
Play with your fork
The project uses Semantic Versioning 2.0.0 and is organized as a monorepo with packages in packages/. You don't have to update version numbers in package.json files as releases are maintained centrally.
- Open your terminal, navigate to local repository directory
- Export AMO's API key and secret as environment variable
$ export WEB_EXT_API_KEY=... $ export WEB_EXT_API_SECRET=... - Install dependencies
$ pnpm install - Create a new topic branch
$ git checkout -b add-new-feature - Run js bundler/watcher and firefox
$ pnpm run watch - Modify source code and firefox will reload the extension automatically
Publishing to Firefox Add-ons
Pushing a version tag publishes the Firefox extension to the existing public
listing on addons.mozilla.org. Before tagging,
update the version in the root package, every workspace package, and both
browser manifests. All versions must match the tag without its v prefix.
The repository must define these GitHub Actions secrets:
WEB_EXT_API_KEY: the AMO API JWT issuerWEB_EXT_API_SECRET: the AMO API JWT secret
Create the credentials on the AMO API key
page. To publish version
0.24.0, push tag v0.24.0:
$ git tag v0.24.0
$ git push origin v0.24.0
The workflow verifies the versions, runs the checks and tests, builds the
extension and reviewer source archive, then submits the extension to AMO's
listed channel. AMO review and approval may complete after the workflow.
Testing
- Run test cases
$ pnpm test
To make sure Turndown conversion remains intact after my modification for supporting MathJax, I use Jest snapshot testing. When you updated Turndown, you have to update snapshots.
- Comment out following line from
packages/core/test/test.jsturndownService.use(turndownPluginMathJax); - Update Jest snapshot
$ pnpm --filter copy-selection-as-markdown-core test -- --updateSnapshot - Revert
packages/core/test/test.js - Run test cases
$ pnpm test
Open a pull request
- Commit your changes locally, rebase onto upstream/master, then push the changes to GitHub
$ git push origin add-new-feature - Go to your fork on GitHub, switch to your topic branch, then click "Compare and pull request" button.
Project Structure
This project is organized as a monorepo with the following packages:
packages/core/- Core functionality and markdown conversion logicpackages/firefox/- Firefox-specific extension code and manifestpackages/chromium/- Chromium-specific extension code and manifest
Each package has its own package.json with specific dependencies and build scripts. The root package.json orchestrates builds across all packages using pnpm workspaces.
References
Package Scripts
Run with pnpm run <script-name> from the project root.
- Watchers
watch: Run watch scripts for all packageswatch:core: Watch core package onlywatch:firefox: Watch Firefox package only
- Builds
build: Build all packages (core, firefox, chromium)generate: Generate WebExtension artifactsformat: Format JS files with Biome
- Testing
test: Run tests across all packages
- Maintenance
clean: Clean all build artifacts