Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrating to Docusaurus from Docsify - part 2 #55

Merged
merged 3 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,23 @@
generated/
output/

# Dependencies
/node_modules

# Production
/build

# Generated files
.docusaurus
.cache-loader

# Misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
3 changes: 3 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
};
7 changes: 6 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
#!/bin/bash

set -e

cd "$(dirname "${BASH_SOURCE:-$0}")"

rm -rf output
mkdir -p output/
cp -R docs/* output/

npm install
npm run build
cp -R build/* output

mkdir -p output/new
cd docusaurus
Expand Down
3 changes: 0 additions & 3 deletions docs/_navbar.md

This file was deleted.

11 changes: 0 additions & 11 deletions docs/_sidebar.md

This file was deleted.

Binary file removed docs/assets/icons/icon-144x144.png
Binary file not shown.
Binary file removed docs/assets/icons/icon-180x180.png
Binary file not shown.
Binary file removed docs/assets/icons/icon-48x48.png
Binary file not shown.
Binary file removed docs/assets/icons/icon-96x96.png
Binary file not shown.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@

Click either the ellipsis button or the Share button as shown in this screenshot:

![Share on macOS](assets/share-on-macos.png)
![Share on macOS](/img/share-on-macos.png)

You can also multi-select your rules and export them by secondary clicking (right-clicking) them on the rule-listing sidebar:

![Share multiple rules on macOS](assets/multiselect-on-macos.png)
![Share multiple rules on macOS](/img/multiselect-on-macos.png)

In addition, you can export all the rules by the menubar > File > Export All Redirect Rules:

![Menubar > File](assets/menubar-file.png)
![Menubar > File](/img/menubar-file.png)

If you want to export your rules in the format compatible with [Einar Egilsson's Redirector](https://einaregilsson.com/redirector/), press the Option key (`⌥`) on the context menu or the menubar, then you'll see these:

![Menubar > File (Redirector)](assets/menubar-file-redirector.png)
![Menubar > File (Redirector)](/img/menubar-file-redirector.png)

![Context Menu (Redirector)](assets/context-menu-redirector.png)
![Context Menu (Redirector)](/img/context-menu-redirector.png)

> [!WARNING]
> Redirect Web is not fully compatible with Redirector, and vise versa. Some settings, such as "Replace Occurrences" for Capturing Group Processing, aren't exported with the Redirector's format.
Expand All @@ -44,4 +44,4 @@ Suppose your rule file is in the Files app. Open it on Files, tap the Share butt

| Step 1: Tap the Share button on Files | Step 2: Select Redirect Web |
|-|-|
| ![Alt text](assets/files-share-ios.png) | ![Alt text](assets/share-sheet-ios.png) |
| ![Alt text](/img/files-share-ios.png) | ![Alt text](/img/share-sheet-ios.png) |
8 changes: 4 additions & 4 deletions docs/faq.md → docs/faq.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

You may see an alert like this when you set up Redirect Web:

![](./assets/prepareExtensionPermissionAlert@3x.png ':size=200')
<img src={require("/img/prepareExtensionPermissionAlert@3x.png").default} alt="An permission requiring alert" width="200" />

> This extension will be able to read and alter webpages and see your browsing history on this website. **This could include sensitive information, including passwords, phone numbers, and credit cards.**

Expand All @@ -14,17 +14,17 @@ Since we don't collect your personal information as per **[the privacy policy](.

But it’s not required. You can only allow it on specific websites. 👌

## Why does this extension require a new permission? :id=permission-alert-on-safari
## Why does this extension require a new permission? \{#permission-alert-on-safari}

You may see this alert in Safari after updating Redirect Web:

![An alert of disabling the app](assets/safari-additional-permission-alert.webp ':size=280')
<img src={require("/img/safari-additional-permission-alert.webp").default} alt="An alert of disabling the app" width="280" />

> "Redirect Web for Safari" has been updated and is requesting additional permissions. To protect your privacy, this extension has been turned off.
>
> You can turn this extension on in the Extensions section of Safari Settings.

This is due to the [declarativeNetRequestWithHostAccess](https://developer.apple.com/documentation/safariservices/safari_web_extensions/blocking_content_with_your_safari_web_extension) permission required by the [DNR](./redirect-rule#type) type introduced in version 7. Please re-enable the extension. Sorry for the inconvenience.
This is due to the [declarativeNetRequestWithHostAccess](https://developer.apple.com/documentation/safariservices/safari_web_extensions/blocking_content_with_your_safari_web_extension) permission required by the [DNR](./rule-settings#type) type introduced in version 7. Please re-enable the extension. Sorry for the inconvenience.

## Will the library's contents become paid in the future?

Expand Down
12 changes: 6 additions & 6 deletions docs/getting-started.md → docs/getting-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

This page describes common use cases for creating redirect rules in the Redirect Web app.

(You can also learn the details of rule settings on the [Redirect Rule](./redirect-rule.md) page.)
(You can also learn the details of rule settings on the [Rule Settings](./rule-settings) page.)


## Case 1: Open another website
Expand All @@ -13,7 +13,7 @@ Suppose you're addicted to Twitter, and you decide to meditate in Insight Timer

First, you should set up the *Redirect From* section in the *Edit Rule* screen in the app. The targets are URLs starting with `https://twitter.com/`.

In this case, you can specify the following pattern with the [Wildcard](redirect-rule?id=wildcard) mode:
In this case, you can specify the following pattern with the [Wildcard](rule-settings?id=wildcard) mode:

```
https://twitter.com/*
Expand All @@ -23,7 +23,7 @@ In the Wildcard mode, `*` means it matches anything (= zero or more characters).

However, hold on. `twitter.com` was renamed to `x.com`. You can simply replace `twitter.com` with `x.com` but no one knows when the new owner will change his mind again to roll it back. Therefore, let's target both `twitter.com` and `x.com`.

To do that, switch from Wildcard to [Regular Expression](redirect-rule?id=regular-expression), and set this as the pattern:
To do that, switch from Wildcard to [Regular Expression](rule-settings?id=regular-expression), and set this as the pattern:

```
https://(twitter|x).com/.*
Expand Down Expand Up @@ -51,7 +51,7 @@ https://insighttimer.com/saraauster/guided-meditations/calm

Now, Redirect Web brings you to the meditation when you access Twitter!

**[⬇️ Download the Rule](assets/reduce-twitter-addiction.redirectweb ':ignore')**
**[⬇️ Download the Rule](/rules/reduce-twitter-addiction.redirectweb)**

## Case 2: Remove Query Parameters from URL

Expand All @@ -68,7 +68,7 @@ In this case, the **Capturing Group Processing** option is the easiest way.:
* **Replacement**: *(none)*
* **Text Pattern**: Regular Expression

**[⬇️ Download the Rule](assets/remove-parameters.redirectweb ':ignore')**
**[⬇️ Download the Rule](/rules/remove-parameters.redirectweb)**

This rule works as follows:

Expand Down Expand Up @@ -148,6 +148,6 @@ In conclusion, this is the final output:
* **Target**: `\?(.*)`
* **Replacement**: `&$1`

**[⬇️ Download the Rule](assets/add-parameters.redirectweb ':ignore')**
**[⬇️ Download the Rule](/rules/add-parameters.redirectweb)**

This is merely an example. You can also create multiple rules to handle each problem. It can be much simpler.
79 changes: 0 additions & 79 deletions docs/index.html

This file was deleted.

6 changes: 5 additions & 1 deletion docs/README.md → docs/introduction.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
---
slug: /
---

# Introduction

[![appstore-badge.svg](./assets/appstore-badge.svg)](https://apps.apple.com/au/app/id1571283503)
[![appstore-badge.svg](/img/appstore-badge.svg)](https://apps.apple.com/au/app/id1571283503)

Welcome to the support website for Redirect Web for Safari, a Safari extension for iOS and macOS.

Expand Down
4 changes: 2 additions & 2 deletions docs/library.md → docs/library.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Library

![Library Screenshot](assets/library-screenshot.webp)
![Library Screenshot](/img/library-screenshot.webp)

Welcome to our library, where you can get redirect rules for free!

Expand All @@ -25,4 +25,4 @@ This might be easier than sending a pull request since you can leave it to us to
## Other Information

- You can see all the contents in [the repository on GitHub](https://github.com/mshibanami/redirect-web/tree/main/docs/library).
- We host our private API server on Cloudflare for the library contents, enabling ust to provide filtering and other services. The app fetches the library contents from this server. As stated in our [our privacy policy](privacy-policy.md), This server does not collect your personal information.
- We host our private API server on Cloudflare for the library contents, enabling ust to provide filtering and other services. The app fetches the library contents from this server. As stated in our [our privacy policy](/privacy-policy), This server does not collect your personal information.
File renamed without changes.
2 changes: 1 addition & 1 deletion docs/redirect-rule.md → docs/rule-settings.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Redirect Rule
# Rule Settings

This page provides detailed information on how to set up redirect rules using Redirect Web.

Expand Down
File renamed without changes.
74 changes: 74 additions & 0 deletions docusaurus.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
import { themes as prismThemes } from 'prism-react-renderer';
import type { Config } from '@docusaurus/types';
import type * as Preset from '@docusaurus/preset-classic';
import remarkGithubAdmonitionsToDirectives from "remark-github-admonitions-to-directives";

const config: Config = {
title: 'Redirect Web for Safari',
tagline: 'Redirect any website',

url: 'https://mshibanami.github.io/',
baseUrl: '/redirect-web/',

organizationName: 'mshibanami',
projectName: 'redirect-web',

onBrokenLinks: 'throw',
onBrokenMarkdownLinks: 'warn',

i18n: {
defaultLocale: 'en',
locales: ['en'],
},

presets: [
[
'classic',
{
docs: {
routeBasePath: '/',
sidebarPath: './sidebars.ts',
sidebarCollapsible: false,
beforeDefaultRemarkPlugins: [remarkGithubAdmonitionsToDirectives],
},
blog: false,
theme: {
customCss: './src/css/custom.css',
},
} satisfies Preset.Options,
],
],

themeConfig: {
// Replace with your project's social card
image: 'img/docusaurus-social-card.jpg',
colorMode: {
disableSwitch: false,
respectPrefersColorScheme: true,
},
navbar: {
title: 'Redirect Web for Safari',
logo: {
alt: 'Site Logo',
src: 'img/logo.svg',
},
items: [
{
href: 'https://github.com/facebook/docusaurus',
label: 'GitHub',
position: 'right',
},
],
},
footer: {
style: 'dark',
copyright: `© ${new Date().getFullYear()} Manabu Nakazawa`,
},
prism: {
theme: prismThemes.github,
darkTheme: prismThemes.dracula,
},
} satisfies Preset.ThemeConfig,
};

export default config;
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading