Skip to content

Commit 49d48d7

Browse files
authored
add support for github style markdown alerts (#3626)
add support for github stype markdown alerts
1 parent d2d4cc9 commit 49d48d7

File tree

5 files changed

+68
-4
lines changed

5 files changed

+68
-4
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
* Remove explicit library names. (#3609)
44
* No longer write the dartdoc version into generated html files.
5+
* Add support for GitHub markdown alert syntax
6+
(https://docs.github.com/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#alerts).
57

68
## 8.0.3
79

lib/resources/styles.css

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1197,3 +1197,67 @@ li.inherited a {
11971197
content: "" !important;
11981198
}
11991199
}
1200+
1201+
/* github alert styles */
1202+
1203+
.markdown-alert {
1204+
padding: .5rem 1rem;
1205+
border-left: 0.25em solid var(--main-sidebar-color);
1206+
margin-bottom: 1rem;
1207+
}
1208+
1209+
.markdown-body p {
1210+
margin-top: 0;
1211+
margin-bottom: 16px;
1212+
}
1213+
1214+
.markdown-alert>:last-child {
1215+
margin-bottom: 0;
1216+
}
1217+
1218+
.markdown-alert-title {
1219+
font-weight: 500;
1220+
color: var(--main-sidebar-color);
1221+
}
1222+
1223+
/* note, tip, important, warning, caution */
1224+
1225+
.markdown-alert-note {
1226+
border-left-color: var(--main-hyperlinks-color);
1227+
}
1228+
1229+
.markdown-alert-note .markdown-alert-title {
1230+
color: var(--main-hyperlinks-color);
1231+
}
1232+
1233+
.markdown-alert-tip {
1234+
border-left-color: var(--main-var-color);
1235+
}
1236+
1237+
.markdown-alert-tip .markdown-alert-title {
1238+
color: var(--main-var-color);
1239+
}
1240+
1241+
.markdown-alert-important {
1242+
border-left-color: var(--main-tag-color);
1243+
}
1244+
1245+
.markdown-alert-important .markdown-alert-title {
1246+
color: var(--main-tag-color);
1247+
}
1248+
1249+
.markdown-alert-warning {
1250+
border-left-color: var(--main-string-color);
1251+
}
1252+
1253+
.markdown-alert-warning .markdown-alert-title {
1254+
color: var(--main-string-color);
1255+
}
1256+
1257+
.markdown-alert-caution {
1258+
border-left-color: var(--main-section-color);
1259+
}
1260+
1261+
.markdown-alert-caution .markdown-alert-title {
1262+
color: var(--main-section-color);
1263+
}

lib/src/dartdoc.dart

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,9 +250,6 @@ class Dartdoc {
250250
}
251251

252252
/// Runs [generateDocs] function and properly handles the errors.
253-
///
254-
/// Passing in a [postProcessCallback] to do additional processing after
255-
/// the documentation is generated.
256253
void executeGuarded() {
257254
onCheckProgress.listen(logProgress);
258255
// This function should *never* `await runZonedGuarded` because the errors

lib/src/markdown_processor.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ final List<md.InlineSyntax> _markdownSyntaxes = [
132132
];
133133

134134
final List<md.BlockSyntax> _markdownBlockSyntaxes = [
135+
const md.AlertBlockSyntax(),
135136
const md.FencedCodeBlockSyntax(),
136137
const md.HeaderWithIdSyntax(),
137138
const md.SetextHeaderWithIdSyntax(),

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ dependencies:
1414
glob: ^2.1.1
1515
html: ^0.15.3
1616
logging: ^1.1.1
17-
markdown: ^7.1.0
17+
markdown: ^7.2.1
1818
meta: ^1.9.1
1919
package_config: ^2.1.0
2020
path: ^1.8.3

0 commit comments

Comments
 (0)