Skip to content

Commit

Permalink
generate supported site doc
Browse files Browse the repository at this point in the history
  • Loading branch information
jonfriesen committed Aug 25, 2024
1 parent 7be1f70 commit 3dcca01
Show file tree
Hide file tree
Showing 6 changed files with 118 additions and 28 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,17 @@ jobs:
- name: Run unit tests
run: npm run test

- name: Generate docs and check for changes
run: |
npm run generate-docs
if git diff --exit-code docs/SUPPORTED_SITES.md; then
echo "No changes detected in SUPPORTED_SITES.md"
else
echo "SUPPORTED_SITES.md is out of date. Please run 'npm run generate-docs' and commit the changes."
git diff docs/SUPPORTED_SITES.md
exit 1
fi
- name: Install Playwright browsers
run: npx playwright install --with-deps

Expand Down
23 changes: 1 addition & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,7 @@ QuickCite is a Chrome extension designed to enhance productivity by allowing use
- Configurable site-specific prefixes
- Enable/disable functionality for specific sites

### Supported Websites

Want support for more sites? Please [submit an issue](https://github.com/jonfriesen/quickcite/issues) to request additional website support!

| Website | Sub-page |
| ------------- | ----------------- |
| **GitHub** | |
| | Pull Request |
| | Issue |
| | Discussion |
| | Repository |
| | User/Organization |
| | Release |
| | Actions |
| **Instagram** | |
| | Profile |
| **LinkedIn** | |
| | Profile |
| | Company |
| | Pulse Article |
| **Trello** | |
| | Boards |
For a detailed list of supported websites and features, please see our [Supported Sites](docs/SUPPORTED_SITES.md) document.

## Installation

Expand Down
6 changes: 1 addition & 5 deletions docs/FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@ QuickCite is a Chrome extension that allows you to quickly copy formatted inform

### Which websites does QuickCite support?

Currently, QuickCite supports:

- GitHub (repositories, issues, pull requests, discussions, user profiles)
- LinkedIn (user profiles, company pages, articles)
- Instagram (user profiles)
See our [Supported Sites](SUPPORTED_SITES.md) document.

### How do I use QuickCite?

Expand Down
58 changes: 58 additions & 0 deletions docs/SUPPORTED_SITES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<!-- DO NOT EDIT; FILE IS GENERATED -->

# Supported Websites and Features

This document is automatically generated based on the current configuration of QuickCite.

## Table of Contents

- [Github](#github)
- [Instagram](#instagram)
- [Linkedin](#linkedin)
- [Trello](#trello)

## Github

- Domain: `github.com`
- Default Prefix: 🐙

| Page Type | Description |
|-----------|-------------|
| Pr | Supports pr pages |
| Issue | Supports issue pages |
| Discussion | Supports discussion pages |
| Repo | Supports repo pages |
| User | Supports user pages |
| Release | Supports release pages |
| Commit | Supports commit pages |
| Actions | Supports actions pages |

## Instagram

- Domain: `instagram.com`
- Default Prefix: 📸

| Page Type | Description |
|-----------|-------------|
| Profile | Supports profile pages |

## Linkedin

- Domain: `linkedin.com`
- Default Prefix: 💼

| Page Type | Description |
|-----------|-------------|
| Profile | Supports profile pages |
| Company | Supports company pages |
| Pulse | Supports pulse pages |

## Trello

- Domain: `trello.com`
- Default Prefix: 📋

| Page Type | Description |
|-----------|-------------|
| Board | Supports board pages |

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"release": "bash scripts/bump_version.sh",
"release_verify": "bash scripts/prerelease_check.sh",
"test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules node_modules/jest/bin/jest.js --testPathIgnorePatterns=\\.e2e\\.test\\.js$",
"e2e": "playwright test"
"e2e": "playwright test",
"generate-docs": "node scripts/generateSupportedSites.js"
},
"keywords": [
"github",
Expand Down
45 changes: 45 additions & 0 deletions scripts/generateSupportedSites.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import fs from 'fs/promises'
import path from 'path'
import siteConfigs from '../src/content/config.js'

async function generateSupportedSitesMarkdown() {
let markdownContent = '<!-- DO NOT EDIT; FILE IS GENERATED -->\n\n'
markdownContent += '# Supported Websites and Features\n\n'
markdownContent += 'This document is automatically generated based on the current configuration of QuickCite.\n\n'

// Generate table of contents
markdownContent += '## Table of Contents\n\n'
for (const siteName of Object.keys(siteConfigs)) {
markdownContent += `- [${capitalize(siteName)}](#${siteName.toLowerCase()})\n`
}
markdownContent += '\n'

for (const [siteName, siteConfig] of Object.entries(siteConfigs)) {
markdownContent += `## ${capitalize(siteName)}\n\n`
markdownContent += `- Domain: \`${siteConfig.domain}\`\n`
markdownContent += `- Default Prefix: ${siteConfig.prefix}\n\n`
markdownContent += '| Page Type | Description |\n'
markdownContent += '|-----------|-------------|\n'

for (const [pageType, pageConfig] of Object.entries(siteConfig.pages)) {
markdownContent += `| ${capitalize(pageType)} | ${getPageDescription(pageType, pageConfig)} |\n`
}

markdownContent += '\n'
}

const outputPath = path.join(process.cwd(), 'docs', 'SUPPORTED_SITES.md')
await fs.writeFile(outputPath, markdownContent, 'utf8')
console.log(`Supported sites markdown generated at ${outputPath}`)
}

function capitalize(string) {
return string.charAt(0).toUpperCase() + string.slice(1)
}

function getPageDescription(pageType, pageConfig) {
// TODO: Add descriptions that are more accurate
return `Supports ${pageType} pages`
}

generateSupportedSitesMarkdown()

0 comments on commit 3dcca01

Please sign in to comment.