Skip to content
This repository was archived by the owner on Feb 6, 2024. It is now read-only.

Commit dd3aa2d

Browse files
merge: from master
2 parents cf32d31 + 64a7ac4 commit dd3aa2d

File tree

3 files changed

+46
-20
lines changed

3 files changed

+46
-20
lines changed

.github/workflows/backup.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Backup Firestore
2+
3+
on:
4+
schedule:
5+
- cron: "0 0 * * *"
6+
7+
env:
8+
PROJECT_ID: deckdeckgo-studio-prod
9+
BUCKET: gs://deckdeckgo-studio-backup
10+
11+
jobs:
12+
backup:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: google-github-actions/setup-gcloud@master
16+
with:
17+
service_account_key: ${{ secrets.FIRESTORE_BACKUP_TOKEN }}
18+
export_default_credentials: true
19+
- run: gcloud info
20+
- run: gcloud config set project $PROJECT_ID
21+
- run: gcloud firestore export $BUCKET
Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,11 @@
11
import marked from 'marked';
22

3-
// Source: https://github.com/markedjs/marked/issues/339
4-
// ![](https://www.nmattia.com/images/autoupdate-notifications.jpg "=100px,20px")
5-
// ![](https://www.nmattia.com/images/autoupdate-notifications.jpg "=100px")
6-
// ![](https://www.nmattia.com/images/autoupdate-notifications.jpg)
7-
3+
// Original source: https://github.com/markedjs/marked/issues/339
4+
// our version:
5+
// ![](https://www.nmattia.com/images/autoupdate-notifications.jpg "width:100px,height:20px")
86
export function changeImgCreation(renderer: marked.Renderer) {
97
renderer.image = (src: string | null, title: string | null, alt: string) => {
10-
const exec = /=\s*(\d*(?:px|em|ex|ch|rem|vw|vh|vmin|vmax|%))\s*,*\s*(\d*(?:px|em|ex|ch|rem|vw|vh|vmin|vmax|%))*\s*$/.exec(title);
11-
12-
let style: string = '';
13-
if (exec) {
14-
if (exec[1]) {
15-
style += `--deckgo-lazy-img-width: ${exec[1].replace(',', '')};`;
16-
}
17-
18-
if (exec[2]) {
19-
style += `--deckgo-lazy-img-height: ${exec[2].replace(',', '')};`;
20-
}
21-
}
22-
8+
const style: string = checkForWidthAndHeight(title);
239
return `<deckgo-lazy-img img-src="${sanitize(src)}" img-alt="${sanitize(alt)}" style="${style}"></deckgo-lazy-img>`;
2410
};
2511
}
@@ -31,3 +17,22 @@ function sanitize(str: string) {
3117
return '&quot;';
3218
});
3319
}
20+
21+
function checkForWidthAndHeight(title): string {
22+
const isWidthSet: RegExpExecArray | null = /width:\d+(?:px|em|ex|ch|rem|vw|vh|vmin|vmax|%)/.exec(title);
23+
const isHeightSet: RegExpExecArray | null = /height:\d+(?:px|em|ex|ch|rem|vw|vh|vmin|vmax|%)/.exec(title);
24+
25+
let style: string = '';
26+
27+
if (isWidthSet) {
28+
const width = /\d+(?:px|em|ex|ch|rem|vw|vh|vmin|vmax|%)/.exec(isWidthSet[0])[0];
29+
style += `--deckgo-lazy-img-width: ${width};`;
30+
}
31+
32+
if (isHeightSet) {
33+
const height = /\d+(?:px|em|ex|ch|rem|vw|vh|vmin|vmax|%)/.exec(isHeightSet[0])[0];
34+
style += `--deckgo-lazy-img-height: ${height};`;
35+
}
36+
37+
return style;
38+
}

webcomponents/markdown/src/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ <h1>Editable:</h1>
3333
<br/>
3434
[Link](https://deckdeckgo.com/)
3535
<br/>
36-
![](https://www.nmattia.com/images/autoupdate-notifications.jpg "=100px,20px")
37-
![](https://www.nmattia.com/images/autoupdate-notifications.jpg "=100px")
36+
![](https://www.nmattia.com/images/autoupdate-notifications.jpg "width:100px,height:20px")
37+
![](https://www.nmattia.com/images/autoupdate-notifications.jpg "width:30px")
3838
![](https://www.nmattia.com/images/autoupdate-notifications.jpg)
3939
<br/>
4040
This is basic paragraph with some **bold text** and also some *italic text*.

0 commit comments

Comments
 (0)