]> git.ardis.lu - static-encrypt/commitdiff
Rearrange sections to highlight example
authorArdis Lu <ardisglu@gmail.com>
Sat, 6 Jul 2024 02:26:48 +0000 (19:26 -0700)
committerArdis Lu <ardisglu@gmail.com>
Sat, 6 Jul 2024 02:26:48 +0000 (19:26 -0700)
README.md

index a23ceb07c30963e4a3961ca69a4dfb0ade6878a8..f5cf0759081a3ae0ae3ce255b6c2c05fa000ca48 100644 (file)
--- a/README.md
+++ b/README.md
@@ -22,6 +22,20 @@ This tool is inspired by and works similarly to [StatiCrypt](https://robinmoisso
     - Press `Download HTML file` to download a ready-to-use web page containing your encrypted content, or
     - Copy the string inside the  `Encrypted content` box and integrate it into your own frontend or use case (see next sections)
 
+## Example
+
+The generated HTML file uses [`document.write()`](https://developer.mozilla.org/en-US/docs/Web/API/Document/write) to replace the entire document when the correct password is entered. So you can input arbitrary HTML into the "Content" box to simulate a new page loading in:
+
+1. Populate HTML into the "Content" box then encrypt and download the HTML page normally:
+
+![The static-encrypt frontend populate with HTML in the "Content" box.](./.github/1.png)
+
+2. The HTML will be displayed only when the correct password is input:
+
+![The downloaded password-protected HTML page with the correct password input.](./.github/2.png)
+
+![The HTML from the "Content" box rendered correctly.](./.github/3.png)
+
 ## `encrypt.js` and `decrypt.js`
 
 Both the `encrypt` and `decrypt` functions are written in vanilla JavaScript with no dependencies and are provided as standalone files for easy integration. Some example uses are described below:
@@ -86,20 +100,6 @@ You can also import the function dynamically (useful for lazy-loading or testing
 const { decrypt } = await import('https://cdn.statically.io/gh/ardislu/static-encrypt/master/decrypt.js');
 ```
 
-### Encrypt an entire HTML page
-
-The generated HTML file uses [`document.write()`](https://developer.mozilla.org/en-US/docs/Web/API/Document/write) to replace the entire document when the correct password is entered. So you can input arbitrary HTML into the "Content" box to simulate a new page loading in:
-
-1. Populate HTML into the "Content" box then encrypt and download the HTML page normally:
-
-![The static-encrypt frontend populate with HTML in the "Content" box.](./.github/1.png)
-
-2. The HTML will be displayed only when the correct password is input:
-
-![The downloaded password-protected HTML page with the correct password input.](./.github/2.png)
-
-![The HTML from the "Content" box rendered correctly.](./.github/3.png)
-
 ### TypeScript
 
 `*.d.ts` files are generated from the [JSDoc](https://jsdoc.app/) comments using `tsc`:
This page took 0.037878 seconds and 4 git commands to generate.