Skip to content
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

feat(markdown): Add tip, caution and important notecard types #11050

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
4 changes: 4 additions & 0 deletions client/src/assets/icons/important.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions client/src/assets/icons/note-caution.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions client/src/assets/icons/tip.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions client/src/ui/molecules/notecards/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,15 @@
}
}

&.caution {
--note-background: var(--background-critical);
--note-theme: var(--icon-critical);

&:before {
mask-image: url("../../../assets/icons/note-caution.svg");
}
}

&.deprecated {
--note-background: var(--background-critical);
--note-theme: var(--icon-critical);
Expand All @@ -101,6 +110,21 @@
}
}

&.tip {
--note-background: var(--background-success);
--note-theme: var(--icon-success);

&:before {
mask-image: url("../../../assets/icons/tip.svg");
}
}

&.important {
&:before {
mask-image: url("../../../assets/icons/important.svg");
}
}

// extra classes added to fix specificity.

&,
Expand Down
12 changes: 12 additions & 0 deletions markdown/localizations/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,22 @@
"msgid": "card_note_label",
"msgstr": ["Hinweis:"]
},
"card_tip_label": {
"msgid": "card_tip_label",
"msgstr": ["Tipp:"]
},
"card_important_label": {
"msgid": "card_important_label",
"msgstr": ["Wichtig:"]
},
"card_warning_label": {
"msgid": "card_warning_label",
"msgstr": ["Warnung:"]
},
"card_caution_label": {
"msgid": "card_caution_label",
"msgstr": ["Vorsicht:"]
},
"card_callout_label": {
"msgid": "card_callout_label",
"msgstr": ["Bemerkung:"]
Expand Down
12 changes: 12 additions & 0 deletions markdown/localizations/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,22 @@
"msgid": "card_note_label",
"msgstr": ["Note:"]
},
"card_tip_label": {
"msgid": "card_tip_label",
"msgstr": ["Tip:"]
},
"card_important_label": {
"msgid": "card_important_label",
"msgstr": ["Important:"]
},
"card_warning_label": {
"msgid": "card_warning_label",
"msgstr": ["Warning:"]
},
"card_caution_label": {
"msgid": "card_caution_label",
"msgstr": ["Caution:"]
},
"card_callout_label": {
"msgid": "card_callout_label",
"msgstr": ["Callout:"]
Expand Down
12 changes: 12 additions & 0 deletions markdown/localizations/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,22 @@
"msgid": "card_note_label",
"msgstr": ["Nota:"]
},
"card_tip_label": {
"msgid": "card_tip_label",
"msgstr": ["Consejo:"]
},
"card_important_label": {
"msgid": "card_important_label",
"msgstr": ["Importante:"]
},
"card_warning_label": {
"msgid": "card_warning_label",
"msgstr": ["Advertencia:"]
},
"card_caution_label": {
"msgid": "card_caution_label",
"msgstr": ["Precaución:"]
},
"card_callout_label": {
"msgid": "card_callout_label",
"msgstr": ["Observación:"]
Expand Down
12 changes: 12 additions & 0 deletions markdown/localizations/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,22 @@
"msgid": "card_note_label",
"msgstr": ["Note :"]
},
"card_tip_label": {
"msgid": "card_tip_label",
"msgstr": ["Conseil :"]
},
"card_important_label": {
"msgid": "card_important_label",
"msgstr": ["Important :"]
},
"card_warning_label": {
"msgid": "card_warning_label",
"msgstr": ["Attention :"]
},
"card_caution_label": {
"msgid": "card_caution_label",
"msgstr": ["Prudence :"]
},
"card_callout_label": {
"msgid": "card_callout_label",
"msgstr": ["Remarque :"]
Expand Down
12 changes: 12 additions & 0 deletions markdown/localizations/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,22 @@
"msgid": "card_note_label",
"msgstr": ["メモ:"]
},
"card_tip_label": {
"msgid": "card_tip_label",
"msgstr": ["ヒント:"]
},
"card_important_label": {
"msgid": "card_important_label",
"msgstr": ["重要:"]
},
"card_warning_label": {
"msgid": "card_warning_label",
"msgstr": ["警告:"]
},
"card_caution_label": {
"msgid": "card_caution_label",
"msgstr": ["注意:"]
},
"card_callout_label": {
"msgid": "card_callout_label",
"msgstr": ["注目:"]
Expand Down
12 changes: 12 additions & 0 deletions markdown/localizations/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,22 @@
"msgid": "card_note_label",
"msgstr": ["참고:"]
},
"card_tip_label": {
"msgid": "card_tip_label",
"msgstr": ["팁:"]
},
"card_important_label": {
"msgid": "card_important_label",
"msgstr": ["중요한:"]
},
"card_warning_label": {
"msgid": "card_warning_label",
"msgstr": ["경고:"]
},
"card_caution_label": {
"msgid": "card_caution_label",
"msgstr": ["주의:"]
},
"card_callout_label": {
"msgid": "card_callout_label",
"msgstr": ["알림:"]
Expand Down
12 changes: 12 additions & 0 deletions markdown/localizations/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,22 @@
"msgid": "card_note_label",
"msgstr": ["Uwaga:"]
},
"card_tip_label": {
"msgid": "card_tip_label",
"msgstr": ["Wskazówka:"]
},
"card_important_label": {
"msgid": "card_important_label",
"msgstr": ["Ważny:"]
},
"card_warning_label": {
"msgid": "card_warning_label",
"msgstr": ["Ważne:"]
},
"card_caution_label": {
"msgid": "card_caution_label",
"msgstr": ["Ostrożność:"]
},
"card_callout_label": {
"msgid": "card_callout_label",
"msgstr": ["Obserwacja:"]
Expand Down
12 changes: 12 additions & 0 deletions markdown/localizations/pt-BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,22 @@
"msgid": "card_note_label",
"msgstr": ["Nota:"]
},
"card_tip_label": {
"msgid": "card_tip_label",
"msgstr": ["Dica:"]
},
"card_important_label": {
"msgid": "card_important_label",
"msgstr": ["Importante:"]
},
"card_warning_label": {
"msgid": "card_warning_label",
"msgstr": ["Aviso:"]
},
"card_caution_label": {
"msgid": "card_caution_label",
"msgstr": ["Cuidado:"]
},
"card_callout_label": {
"msgid": "card_callout_label",
"msgstr": ["Observação:"]
Expand Down
12 changes: 12 additions & 0 deletions markdown/localizations/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,22 @@
"msgid": "card_note_label",
"msgstr": ["Примечание:"]
},
"card_tip_label": {
"msgid": "card_tip_label",
"msgstr": ["Кончик:"]
},
"card_important_label": {
"msgid": "card_important_label",
"msgstr": ["Важный:"]
},
"card_warning_label": {
"msgid": "card_warning_label",
"msgstr": ["Предупреждение:"]
},
"card_caution_label": {
"msgid": "card_caution_label",
"msgstr": ["Осторожность:"]
},
"card_callout_label": {
"msgid": "card_callout_label",
"msgstr": ["Сноска:"]
Expand Down
12 changes: 12 additions & 0 deletions markdown/localizations/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,22 @@
"msgid": "card_note_label",
"msgstr": ["备注:"]
},
"card_tip_label": {
"msgid": "card_tip_label",
"msgstr": ["提示:"]
},
"card_important_label": {
"msgid": "card_important_label",
"msgstr": ["重要的:"]
},
"card_warning_label": {
"msgid": "card_warning_label",
"msgstr": ["警告:"]
},
"card_caution_label": {
"msgid": "card_caution_label",
"msgstr": ["警告:"]
},
"card_callout_label": {
"msgid": "card_callout_label",
"msgstr": ["标注:"]
Expand Down
12 changes: 12 additions & 0 deletions markdown/localizations/zh-TW.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,22 @@
"msgid": "card_note_label",
"msgstr": ["備註:"]
},
"card_tip_label": {
"msgid": "card_tip_label",
"msgstr": ["提示:"]
},
"card_important_label": {
"msgid": "card_important_label",
"msgstr": ["重要的:"]
},
"card_warning_label": {
"msgid": "card_warning_label",
"msgstr": ["警告:"]
},
"card_caution_label": {
"msgid": "card_caution_label",
"msgstr": ["警告:"]
},
"card_callout_label": {
"msgid": "card_callout_label",
"msgstr": ["標註:"]
Expand Down
2 changes: 1 addition & 1 deletion markdown/m2h/handlers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ interface NotecardType {
}

function getNotecardType(node: any, locale: Locale): NotecardType | null {
const types = ["note", "warning", "callout"];
const types = ["note", "tip", "important", "warning", "caution", "callout"];

if (!node.children) {
return null;
Expand Down