Browse Source

Add "Copy to clipboard" buttons to code blocks in docs

DarthSim 5 years ago
parent
commit
a16a268ae7

+ 2 - 2
docs/GETTING_STARTED.md

@@ -7,8 +7,8 @@ This guide will show you how to get your first image resized with imgproxy quick
 Let's assume you have Docker installed on your machine. Then you can pull an official imgproxy image, and you're done!
 Let's assume you have Docker installed on your machine. Then you can pull an official imgproxy image, and you're done!
 
 
 ```bash
 ```bash
-$ docker pull darthsim/imgproxy:latest
-$ docker run -p 8080:8080 -it darthsim/imgproxy
+docker pull darthsim/imgproxy:latest
+docker run -p 8080:8080 -it darthsim/imgproxy
 ```
 ```
 
 
 If you don't have docker, you can use Heroku for a quick start.
 If you don't have docker, you can use Heroku for a quick start.

+ 2 - 0
docs/assets/style.css

@@ -22,6 +22,8 @@
 
 
   --sidebar-background: var(--mono-shade4);
   --sidebar-background: var(--mono-shade4);
   --sidebar-border-color: hsla(0,0%,100%,.4);
   --sidebar-border-color: hsla(0,0%,100%,.4);
+
+  --copycode-background: var(--link-color);
 }
 }
 
 
 .content {
 .content {

+ 3 - 3
docs/configuration.md

@@ -15,13 +15,13 @@ You can specify multiple key/salt pairs by dividing keys and salts with comma (`
 You can also specify paths to files with a hex-encoded keys and salts, one by line (useful in a development environment):
 You can also specify paths to files with a hex-encoded keys and salts, one by line (useful in a development environment):
 
 
 ```bash
 ```bash
-$ imgproxy -keypath /path/to/file/with/key -saltpath /path/to/file/with/salt
+imgproxy -keypath /path/to/file/with/key -saltpath /path/to/file/with/salt
 ```
 ```
 
 
 If you need a random key/salt pair real fast, you can quickly generate it using, for example, the following snippet:
 If you need a random key/salt pair real fast, you can quickly generate it using, for example, the following snippet:
 
 
 ```bash
 ```bash
-$ echo $(xxd -g 2 -l 64 -p /dev/random | tr -d '\n')
+echo $(xxd -g 2 -l 64 -p /dev/random | tr -d '\n')
 ```
 ```
 
 
 ## Server
 ## Server
@@ -140,7 +140,7 @@ There are two ways to define presets:
 #### Using a command line argument
 #### Using a command line argument
 
 
 ```bash
 ```bash
-$ imgproxy -presets /path/to/file/with/presets
+imgproxy -presets /path/to/file/with/presets
 ```
 ```
 
 
 The file should contain preset definitions, one per line. Lines starting with `#` are treated as comments. Example:
 The file should contain preset definitions, one per line. Lines starting with `#` are treated as comments. Example:

+ 1 - 0
docs/index.html

@@ -57,6 +57,7 @@
   <script src="https://cdn.jsdelivr.net/npm/docsify-themeable@0"></script>
   <script src="https://cdn.jsdelivr.net/npm/docsify-themeable@0"></script>
   <script src="//unpkg.com/docsify/lib/plugins/search.min.js"></script>
   <script src="//unpkg.com/docsify/lib/plugins/search.min.js"></script>
   <script src="//unpkg.com/docsify-pagination/dist/docsify-pagination.min.js"></script>
   <script src="//unpkg.com/docsify-pagination/dist/docsify-pagination.min.js"></script>
+  <script src="https://unpkg.com/docsify-copy-code@2"></script>
   <link href="https://fonts.googleapis.com/css?family=Fira+Mono|Roboto:400,700&display=swap" rel="stylesheet">
   <link href="https://fonts.googleapis.com/css?family=Fira+Mono|Roboto:400,700&display=swap" rel="stylesheet">
 </body>
 </body>
 </html>
 </html>

+ 17 - 17
docs/installation.md

@@ -7,15 +7,15 @@ There are four ways you can install imgproxy:
 imgproxy can (and should) be used as a standalone application inside a Docker container. Just pull the official image from Docker Hub:
 imgproxy can (and should) be used as a standalone application inside a Docker container. Just pull the official image from Docker Hub:
 
 
 ```bash
 ```bash
-$ docker pull darthsim/imgproxy:latest
-$ docker run -p 8080:8080 -it darthsim/imgproxy
+docker pull darthsim/imgproxy:latest
+docker run -p 8080:8080 -it darthsim/imgproxy
 ```
 ```
 
 
 You can also build your own image. imgproxy is ready to be dockerized, plug and play:
 You can also build your own image. imgproxy is ready to be dockerized, plug and play:
 
 
 ```bash
 ```bash
-$ docker build -t imgproxy .
-$ docker run -p 8080:8080 -it imgproxy
+docker build -t imgproxy .
+docker run -p 8080:8080 -it imgproxy
 ```
 ```
 
 
 ## Heroku
 ## Heroku
@@ -27,10 +27,10 @@ imgproxy can be deployed to Heroku with a click of a button:
 However, you can do it manually with a few steps:
 However, you can do it manually with a few steps:
 
 
 ```bash
 ```bash
-$ git clone https://github.com/imgproxy/imgproxy.git && cd imgproxy
-$ heroku create your-application
-$ heroku stack:set container
-$ git push heroku master
+git clone https://github.com/imgproxy/imgproxy.git && cd imgproxy
+heroku create your-application
+heroku stack:set container
+git push heroku master
 ```
 ```
 
 
 ## Packages
 ## Packages
@@ -48,9 +48,9 @@ First, install [libvips](https://github.com/libvips/libvips).
 Ubuntu apt repository contains a pretty old version of libvips. You can use PPA with more recent version of libvips:
 Ubuntu apt repository contains a pretty old version of libvips. You can use PPA with more recent version of libvips:
 
 
 ```bash
 ```bash
-$ sudo add-apt-repository ppa:dhor/myway
-$ sudo apt-get update
-$ sudo apt-get install libvips-dev
+sudo add-apt-repository ppa:dhor/myway
+sudo apt-get update
+sudo apt-get install libvips-dev
 ```
 ```
 
 
 But if you want to use all the features of imgproxy, it's recommended to build libvips from the source: [https://github.com/libvips/ libvips/wiki/Build-for-Ubuntu](https://github.com/libvips/libvips/wiki/Build-for-Ubuntu)
 But if you want to use all the features of imgproxy, it's recommended to build libvips from the source: [https://github.com/libvips/ libvips/wiki/Build-for-Ubuntu](https://github.com/libvips/libvips/wiki/Build-for-Ubuntu)
@@ -58,22 +58,22 @@ But if you want to use all the features of imgproxy, it's recommended to build l
 Next, install the latest Go:
 Next, install the latest Go:
 
 
 ```bash
 ```bash
-$ sudo add-apt-repository ppa:longsleep/golang-backports
-$ sudo apt-get update
-$ sudo apt-get install golang-go
+sudo add-apt-repository ppa:longsleep/golang-backports
+sudo apt-get update
+sudo apt-get install golang-go
 ```
 ```
 
 
 And finally, install imgproxy itself:
 And finally, install imgproxy itself:
 
 
 ```bash
 ```bash
-$ CGO_LDFLAGS_ALLOW="-s|-w" go get -f -u github.com/imgproxy/imgproxy
+CGO_LDFLAGS_ALLOW="-s|-w" go get -f -u github.com/imgproxy/imgproxy
 ```
 ```
 
 
 ### macOS + Homebrew
 ### macOS + Homebrew
 
 
 ```bash
 ```bash
-$ brew install vips go
-$ PKG_CONFIG_PATH="$(brew --prefix libffi)/lib/pkgconfig" \
+brew install vips go
+PKG_CONFIG_PATH="$(brew --prefix libffi)/lib/pkgconfig" \
   CGO_LDFLAGS_ALLOW="-s|-w" \
   CGO_LDFLAGS_ALLOW="-s|-w" \
   CGO_CFLAGS_ALLOW="-Xpreprocessor" \
   CGO_CFLAGS_ALLOW="-Xpreprocessor" \
   go get -f -u github.com/imgproxy/imgproxy
   go get -f -u github.com/imgproxy/imgproxy

+ 1 - 1
docs/serving_files_from_s3.md

@@ -23,7 +23,7 @@ There are three ways to specify your AWS credentials. The credentials need to ha
 You can specify AWS Acces Key ID and Secret Access Key by setting the standard `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` environment variables.
 You can specify AWS Acces Key ID and Secret Access Key by setting the standard `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` environment variables.
 
 
 ``` bash
 ``` bash
-$ AWS_ACCESS_KEY_ID=my_access_key AWS_SECRET_ACCESS_KEY=my_secret_key imgproxy
+AWS_ACCESS_KEY_ID=my_access_key AWS_SECRET_ACCESS_KEY=my_secret_key imgproxy
 
 
 # same for Docker
 # same for Docker
 docker run -e AWS_ACCESS_KEY_ID=my_access_key -e AWS_SECRET_ACCESS_KEY=my_secret_key -it darthsim/imgproxy
 docker run -e AWS_ACCESS_KEY_ID=my_access_key -e AWS_SECRET_ACCESS_KEY=my_secret_key -it darthsim/imgproxy

+ 1 - 1
docs/serving_local_files.md

@@ -10,7 +10,7 @@ imgproxy can be configured to process files from your local filesystem. To use t
 Assume you want to process an image that stored locally at `/path/to/project/images/logos/evil_martians.png`. Run imgproxy with `IMGPROXY_LOCAL_FILESYSTEM_ROOT` set to your images directory:
 Assume you want to process an image that stored locally at `/path/to/project/images/logos/evil_martians.png`. Run imgproxy with `IMGPROXY_LOCAL_FILESYSTEM_ROOT` set to your images directory:
 
 
 ```bash
 ```bash
-$ IMGPROXY_LOCAL_FILESYSTEM_ROOT=/path/to/project/images imgproxy
+IMGPROXY_LOCAL_FILESYSTEM_ROOT=/path/to/project/images imgproxy
 ```
 ```
 
 
 Then use path inside this directory as the source URL:
 Then use path inside this directory as the source URL:

+ 2 - 2
docs/signing_the_url.md

@@ -14,7 +14,7 @@ Read our [Configuration](configuration.md#url-signature) guide to find more ways
 If you need a random key/salt pair real fast, you can quickly generate it using, for example, the following snippet:
 If you need a random key/salt pair real fast, you can quickly generate it using, for example, the following snippet:
 
 
 ```bash
 ```bash
-$ echo $(xxd -g 2 -l 64 -p /dev/random | tr -d '\n')
+echo $(xxd -g 2 -l 64 -p /dev/random | tr -d '\n')
 ```
 ```
 
 
 ### Calculating URL signature
 ### Calculating URL signature
@@ -43,7 +43,7 @@ http://imgproxy.example.com/insecure/fill/300/400/sm/0/aHR0cDovL2V4YW1w/bGUuY29t
 To sign it, you need to configure imgproxy to use your key/salt pair. Let's say, your key and salt are `secret` and `hello` — that translates to `736563726574` and `68656C6C6F` in hex encoding. This key/salt pair is quite weak for production use but will do for this example. Run your imgproxy using this key/salt pair:
 To sign it, you need to configure imgproxy to use your key/salt pair. Let's say, your key and salt are `secret` and `hello` — that translates to `736563726574` and `68656C6C6F` in hex encoding. This key/salt pair is quite weak for production use but will do for this example. Run your imgproxy using this key/salt pair:
 
 
 ```bash
 ```bash
-$ IMGPROXY_KEY=736563726574 IMGPROXY_SALT=68656C6C6F imgproxy
+IMGPROXY_KEY=736563726574 IMGPROXY_SALT=68656C6C6F imgproxy
 ```
 ```
 
 
 Note that all your unsigned URL will stop working since imgproxy now checks signatures of all URLs.
 Note that all your unsigned URL will stop working since imgproxy now checks signatures of all URLs.

+ 4 - 1
docs/watermark.md

@@ -6,9 +6,12 @@ imgproxy supports watermarking processed images with another image.
 
 
 There are three ways to specify a watermark image using environment variables:
 There are three ways to specify a watermark image using environment variables:
 
 
-* `IMGPROXY_WATERMARK_DATA`: Base64-encoded image data. You can easily calculate it with `base64 tmp/watermark.webp | tr -d '\n'`.
 * `IMGPROXY_WATERMARK_PATH`: path to the locally stored image.
 * `IMGPROXY_WATERMARK_PATH`: path to the locally stored image.
 * `IMGPROXY_WATERMARK_URL`: watermark image URL.
 * `IMGPROXY_WATERMARK_URL`: watermark image URL.
+* `IMGPROXY_WATERMARK_DATA`: Base64-encoded image data. You can easily calculate it with the following snippet:
+  ```bash
+  base64 tmp/watermark.webp | tr -d '\n'`.
+  ```
 
 
 You can also specify the base opacity of watermark with `IMGPROXY_WATERMARK_OPACITY`.
 You can also specify the base opacity of watermark with `IMGPROXY_WATERMARK_OPACITY`.