Commit ac83f5e1 authored by Ricardo Lafuente's avatar Ricardo Lafuente

More recipes

parent b3f0b12d
......@@ -55,5 +55,42 @@ cd images/2.4
for f in *; do echo $f; mogrify -resize 1800x1400\> $f; done
```
or, to alter all images in subdirectories:
grep 'jquery' issue* -lr | xargs vim -p
```bash
cd images
find . -name "*" | xargs mogrify -resize 970x4000\>
```
### Review text files with a particular string
We needed to check every instance of a lowercase acronym (e.g. "svg") and edit it manually if it needed to be made uppercase again.
```bash
grep '\bsvg\b' issue* -lr | xargs vim -p
```
### Turn all images into image links
We wanted to change all images into a thumbnail which would then link to the original image.
So this
```markdown
![](/images/2.1/picture.png)
```
should become
```markdown
[![](/images-small/2.1/picture.png)](/images/2.1/picture.png)
```
So we use the following sed script:
```bash
cd content
find . -name "*.md" | xargs sed -i 's/!\[\](\(.*\))/[![](\1)](\1)/g; s/images/images-small/'
```
The sed operation comes in two parts: first we create the "image inside link", and after that we fix the directory of the thumbnail so that it points to the `images-small` directory.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment