Skip to content

Commit bbf28e4

Browse files
authored
Image zoom and alt text (#275)
* add medium-zoom * fix openssl error * add docs how to create images
1 parent 91148f5 commit bbf28e4

File tree

11 files changed

+181
-87
lines changed

11 files changed

+181
-87
lines changed

.github/workflows/checks.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,19 @@ on: push
55
jobs:
66
spellcheck:
77
runs-on: ubuntu-latest
8-
98
steps:
109
- uses: actions/checkout@v3
10+
11+
# need Node 16 or less to get rid of ERR_OSSL_EVP_UNSUPPORTED
12+
- uses: actions/setup-node@v3
13+
with:
14+
node-version: 16
15+
1116
- name: Generate dist
1217
run: |
1318
yarn install
1419
yarn build
15-
20+
1621
- name: "Check dist dir consistency"
1722
uses: andstor/file-existence-action@v1
1823
with:
@@ -26,9 +31,14 @@ jobs:
2631

2732
broken_links:
2833
runs-on: ubuntu-latest
29-
3034
steps:
3135
- uses: actions/checkout@v3
36+
37+
# need Node 16 or less to get rid of ERR_OSSL_EVP_UNSUPPORTED
38+
- uses: actions/setup-node@v3
39+
with:
40+
node-version: 16
41+
3242
- name: Generate dist
3343
run: |
3444
yarn install

.github/workflows/dist-dev.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,21 @@ jobs:
1717
deploy_dev:
1818
runs-on: ubuntu-latest
1919
steps:
20-
- uses: actions/checkout@v2
20+
- uses: actions/checkout@v3
21+
22+
# need Node 16 or less to get rid of ERR_OSSL_EVP_UNSUPPORTED
23+
- uses: actions/setup-node@v3
24+
with:
25+
node-version: 16
26+
2127
- name: Install
2228
run: |
2329
yarn install
30+
2431
- name: Generate dist
2532
run: |
2633
yarn build
34+
2735
- name: "Check dist dir consistency"
2836
uses: andstor/file-existence-action@v1
2937
with:

.github/workflows/dist-prod.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,27 @@ jobs:
1414
deploy_prod:
1515
runs-on: ubuntu-latest
1616
steps:
17-
- uses: actions/checkout@v2
17+
- uses: actions/checkout@v3
18+
19+
# need Node 16 or less to get rid of ERR_OSSL_EVP_UNSUPPORTED
20+
- uses: actions/setup-node@v3
21+
with:
22+
node-version: 16
23+
1824
- name: Install
1925
run: |
2026
yarn install
27+
2128
- name: Generate dist
2229
run: |
2330
yarn build
31+
2432
- name: "Check dist dir consistency"
2533
uses: andstor/file-existence-action@v1
2634
with:
2735
files: "dist/docs/index.html"
2836
allow_failure: true # Makes the Action fail on missing files
29-
37+
3038
- name: Configure AWS credentials
3139
uses: aws-actions/configure-aws-credentials@v1
3240
with:

README.md

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,7 @@ cd merginmaps/docs
4242
yarn install
4343
yarn dev
4444
```
45-
46-
If you get ` opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ]`, run
47-
```bash
48-
export NODE_OPTIONS=--openssl-legacy-provider
49-
```
50-
45+
5146
## Static generation (for deployments)
5247

5348
To generate static HTML files, run
@@ -60,6 +55,20 @@ yarn build
6055

6156
and see the result in `dist` folder
6257

58+
### Error for nodejs 17
59+
60+
If you get `opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ]`, run
61+
```bash
62+
export NODE_OPTIONS=--openssl-legacy-provider
63+
```
64+
65+
or on Windows
66+
```bash
67+
set NODE_OPTIONS=--openssl-legacy-provider
68+
```
69+
70+
or downgrade `nodejs` to 16 or less. More here: https://github.com/webpack/webpack/issues/14532
71+
6372
# License
6473

6574
The Mergin Maps product documentation in the `src` are licensed under a [CC-BY license](LICENSE).

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@
1414
"build": "vuepress build src",
1515
"export": "vuepress export src"
1616
},
17-
"devDependencies": {
18-
"vuepress": "^1.9.7",
17+
"devDependencies": {
18+
"@vuepress/plugin-medium-zoom": "^1.9.8",
19+
"vuepress": "^1.9.8",
1920
"vuepress-plugin-clean-urls": "^1.1.2",
2021
"vuepress-plugin-fulltext-search": "^2.2.1",
2122
"vuepress-plugin-google-tag-manager": "0.0.5"

scripts/wordlist.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ prepopulated
185185
programmatically
186186
proj
187187
px
188+
kb
188189
qca
189190
qgs
190191
qgz

src/.vuepress/components/PublicImage.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
<template>
2-
<img :src="$withBase(`/${src}`)">
2+
<img :src="$withBase(`/${src}`)" :title="`${title}`" :alt="`${alt}`">
33
</template>
44

55
<script>
66
export default {
77
name: "publicimage",
88
props: {
9-
src: String
9+
src: String,
10+
title: String,
11+
alt: String
1012
}
1113
}
1214
</script>

src/.vuepress/config.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@ var path = require('path')
33
const pageSuffix = '/'
44

55
module.exports = {
6+
/**
7+
* fix ERR_OSSL_EVP_UNSUPPORTED for webpack4
8+
* https://stackoverflow.com/a/73027407/2838364
9+
*/
10+
configureWebpack: {
11+
output: {hashFunction: 'sha256'}
12+
},
13+
614
/**
715
* Ref:https://v1.vuepress.vuejs.org/config/#title
816
*/
@@ -72,6 +80,7 @@ module.exports = {
7280
['vuepress-plugin-google-tag-manager', {
7381
'gtm': 'GTM-NW7ZGNB'
7482
}],
83+
['@vuepress/medium-zoom'],
7584
[ 'clean-urls', {
7685
normalSuffix: pageSuffix,
7786
indexSuffix: pageSuffix

src/misc/troubleshoot.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Need more help with your issue? <LutraConsultingWeb /> provides commercial suppo
1818

1919
The commercial support or consultancy for your projects is carried by <LutraConsultingWeb />
2020

21-
<PublicImage src="logo_lutra.svg" />
21+
<PublicImage src="logo_lutra.svg" title="Lutra Consulting Ltd. logo" />
2222

2323
Please see the <LutraConsultingWeb id="support/" desc="support packages" /> available. SLA support offers you the contracted response time, dedicated hotline as well as premium email support.
2424

src/misc/write-docs/index.md

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -282,22 +282,40 @@ You can use any of supported <GitHubRepo id="markdown-it/markdown-it-emoji/blob/
282282
* Stroke the selection with red, at width:
283283
* Desktop: 3px
284284
* Mobile: 12px
285-
286285

286+
#### Export, title and alt
287+
288+
Every exported image:
289+
290+
* has `webp` (preferable) or `jpg` format
291+
* has around 50-150kb. Only images where zoomed detail is important could have higher size.
292+
* has title and alt text (exception: don't add alt text to decorative images like icons that are not part of docs)
293+
294+
e.g. `![image alt text](./myimage.png "image title")`
295+
296+
The image alt text is used to describe images to users who can't see them (they are using a screen-reader or image failed to load). The image title attribute is only visible on mouse-over and displays just the title over image.
297+
298+
For texts:
299+
300+
* Usually, use the same for alt and titles
301+
* Include text that's part of the image
302+
* Use keywords sparingly - describe in simple words
303+
* Never start with “Image of …” or “Picture of …”
304+
* Be specific and succinct
287305

288306
#### Referencing
289307

290308
- Do not add `docs` prefix (base)
291309
- Place images next to the markdown files that reference them
292310
- Do not start with `/`, use relative paths
293311

294-
e.g. `![](./myimage.png)` if the image is in the same folder as your markdown file
312+
e.g. `![image alt text](./myimage.png "image title")` if the image is in the same folder as your markdown file
295313

296314
- For global pictures/assets placed in `src/.vuepress/public` use custom component `<PublicImage />`
297315

298-
e.g. `<PublicImage src="MM_logo_HORIZ_color.svg" />`
316+
e.g. `<PublicImage src="MM_logo_HORIZ_color.svg" title="Mergin Maps logo"/>`
299317

300-
<PublicImage src="MM_logo_HORIZ_color.svg" />
318+
<PublicImage src="MM_logo_HORIZ_color.svg" title="Mergin Maps logo" />
301319

302320
### Table of Contents
303321

0 commit comments

Comments
 (0)