Skip to content

Image zoom and alt text #275

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

Merged
merged 11 commits into from
Feb 22, 2023
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
16 changes: 13 additions & 3 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,19 @@ on: push
jobs:
spellcheck:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

# need Node 16 or less to get rid of ERR_OSSL_EVP_UNSUPPORTED
- uses: actions/setup-node@v3
with:
node-version: 16

- name: Generate dist
run: |
yarn install
yarn build

- name: "Check dist dir consistency"
uses: andstor/file-existence-action@v1
with:
Expand All @@ -26,9 +31,14 @@ jobs:

broken_links:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

# need Node 16 or less to get rid of ERR_OSSL_EVP_UNSUPPORTED
- uses: actions/setup-node@v3
with:
node-version: 16

- name: Generate dist
run: |
yarn install
Expand Down
10 changes: 9 additions & 1 deletion .github/workflows/dist-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,21 @@ jobs:
deploy_dev:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

# need Node 16 or less to get rid of ERR_OSSL_EVP_UNSUPPORTED
- uses: actions/setup-node@v3
with:
node-version: 16

- name: Install
run: |
yarn install

- name: Generate dist
run: |
yarn build

- name: "Check dist dir consistency"
uses: andstor/file-existence-action@v1
with:
Expand Down
12 changes: 10 additions & 2 deletions .github/workflows/dist-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,27 @@ jobs:
deploy_prod:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

# need Node 16 or less to get rid of ERR_OSSL_EVP_UNSUPPORTED
- uses: actions/setup-node@v3
with:
node-version: 16

- name: Install
run: |
yarn install

- name: Generate dist
run: |
yarn build

- name: "Check dist dir consistency"
uses: andstor/file-existence-action@v1
with:
files: "dist/docs/index.html"
allow_failure: true # Makes the Action fail on missing files

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
Expand Down
21 changes: 15 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,7 @@ cd merginmaps/docs
yarn install
yarn dev
```

If you get ` opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ]`, run
```bash
export NODE_OPTIONS=--openssl-legacy-provider
```


## Static generation (for deployments)

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

and see the result in `dist` folder

### Error for nodejs 17

If you get `opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ]`, run
```bash
export NODE_OPTIONS=--openssl-legacy-provider
```

or on Windows
```bash
set NODE_OPTIONS=--openssl-legacy-provider
```

or downgrade `nodejs` to 16 or less. More here: https://github.com/webpack/webpack/issues/14532

# License

The Mergin Maps product documentation in the `src` are licensed under a [CC-BY license](LICENSE).
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@
"build": "vuepress build src",
"export": "vuepress export src"
},
"devDependencies": {
"vuepress": "^1.9.7",
"devDependencies": {
"@vuepress/plugin-medium-zoom": "^1.9.8",
"vuepress": "^1.9.8",
"vuepress-plugin-clean-urls": "^1.1.2",
"vuepress-plugin-fulltext-search": "^2.2.1",
"vuepress-plugin-google-tag-manager": "0.0.5"
Expand Down
1 change: 1 addition & 0 deletions scripts/wordlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ prepopulated
programmatically
proj
px
kb
qca
qgs
qgz
Expand Down
6 changes: 4 additions & 2 deletions src/.vuepress/components/PublicImage.vue
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
<template>
<img :src="$withBase(`/${src}`)">
<img :src="$withBase(`/${src}`)" :title="`${title}`" :alt="`${alt}`">
</template>

<script>
export default {
name: "publicimage",
props: {
src: String
src: String,
title: String,
alt: String
}
}
</script>
Expand Down
9 changes: 9 additions & 0 deletions src/.vuepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ var path = require('path')
const pageSuffix = '/'

module.exports = {
/**
* fix ERR_OSSL_EVP_UNSUPPORTED for webpack4
* https://stackoverflow.com/a/73027407/2838364
*/
configureWebpack: {
output: {hashFunction: 'sha256'}
},

/**
* Ref:https://v1.vuepress.vuejs.org/config/#title
*/
Expand Down Expand Up @@ -72,6 +80,7 @@ module.exports = {
['vuepress-plugin-google-tag-manager', {
'gtm': 'GTM-NW7ZGNB'
}],
['@vuepress/medium-zoom'],
[ 'clean-urls', {
normalSuffix: pageSuffix,
indexSuffix: pageSuffix
Expand Down
2 changes: 1 addition & 1 deletion src/misc/troubleshoot.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Need more help with your issue? <LutraConsultingWeb /> provides commercial suppo

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

<PublicImage src="logo_lutra.svg" />
<PublicImage src="logo_lutra.svg" title="Lutra Consulting Ltd. logo" />

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.

Expand Down
26 changes: 22 additions & 4 deletions src/misc/write-docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -282,22 +282,40 @@ You can use any of supported <GitHubRepo id="markdown-it/markdown-it-emoji/blob/
* Stroke the selection with red, at width:
* Desktop: 3px
* Mobile: 12px


#### Export, title and alt

Every exported image:

* has `webp` (preferable) or `jpg` format
* has around 50-150kb. Only images where zoomed detail is important could have higher size.
* has title and alt text (exception: don't add alt text to decorative images like icons that are not part of docs)

e.g. `![image alt text](./myimage.png "image title")`

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.

For texts:

* Usually, use the same for alt and titles
* Include text that's part of the image
* Use keywords sparingly - describe in simple words
* Never start with “Image of …” or “Picture of …”
* Be specific and succinct

#### Referencing

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

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

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

e.g. `<PublicImage src="MM_logo_HORIZ_color.svg" />`
e.g. `<PublicImage src="MM_logo_HORIZ_color.svg" title="Mergin Maps logo"/>`

<PublicImage src="MM_logo_HORIZ_color.svg" />
<PublicImage src="MM_logo_HORIZ_color.svg" title="Mergin Maps logo" />

### Table of Contents

Expand Down
Loading