Skip to content

Commit 747ee6b

Browse files
anysadKade-github
authored andcommitted
feature: github styled alerts
1 parent d3a6dce commit 747ee6b

File tree

10 files changed

+94
-4
lines changed

10 files changed

+94
-4
lines changed

assets/content/cookbook/Intermediate/4.Migration.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ Once all the migration steps above have been performed, the last step is to modi
6969
}
7070
```
7171

72-
> NOTE: For versions of Friday Night Funkin' between v0.3.0 and v0.4.1, the modding system always looked for `"0.1.0"` for the `api_version` and refused to load the mod in all other cases. With the v0.5.0 update, this version will now change to match the game version with every update, but only breaking changes will forcibly disable mods. Those breaking changes will be documented on this page.
72+
> [!NOTE]
73+
> For versions of Friday Night Funkin' between v0.3.0 and v0.4.1, the modding system always looked for `"0.1.0"` for the `api_version` and refused to load the mod in all other cases. With the v0.5.0 update, this version will now change to match the game version with every update, but only breaking changes will forcibly disable mods. Those breaking changes will be documented on this page.
7374
7475
# Migrating from v0.5.0 to v0.6.3
7576

assets/content/cookbook/Introduction/5.AppendingAndMerge.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ CSV and TSV files can be merged as well. In this case, the mod loader will look
7878

7979
### Merging into XML Files
8080

81-
> NOTE: The behavior of Merging XML files may change significantly in the near future.
81+
> [!CAUTION]
82+
> The behavior of Merging XML files may change significantly in the near future.
8283
8384
For XML, you must create an XML document containing the desired, values, with additional information to inform Polymod about where to insert it.
8485

@@ -141,7 +142,9 @@ As soon as it finds the first match, it stops and merges the payload with the sp
141142

142143
### Merging into JSON Files
143144

144-
Merging into JSON files is done using a [JSON Patch](https://jsonpatch.com/) document. (NOTE: This significantly differs from JSON patch files created for v0.4.1 and earlier, which used a different system that honestly kinda sucked).
145+
Merging into JSON files is done using a [JSON Patch](https://jsonpatch.com/) document.
146+
> [!NOTE]
147+
> This significantly differs from JSON patch files created for v0.4.1 and earlier, which used a different system that honestly kinda sucked.
145148
146149
Say we have a JSON data file `data/songs/mysong-metadata.json` like below:
147150

assets/includes/css/styles.css

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,71 @@ blockquote.author-info {
272272
border-left: 4px solid #EA8220;
273273
}
274274

275+
.markdown-alert {
276+
padding: 0.5rem 1rem;
277+
margin-bottom: 1rem;
278+
color: inherit;
279+
border-left: .25em solid #d1d9e0;
280+
}
281+
282+
.markdown-alert>:first-child {
283+
margin-top: 0;
284+
}
285+
286+
.markdown-alert>:last-child {
287+
margin-top: 0;
288+
}
289+
290+
.markdown-alert-image {
291+
margin-right: 8px;
292+
}
293+
294+
.markdown-alert .markdown-alert-title {
295+
display: flex;
296+
font-weight: bold;
297+
align-items: center;
298+
line-height: 1;
299+
}
300+
301+
.markdown-alert.markdown-alert-note {
302+
border-left-color: #0969da;
303+
}
304+
.markdown-alert.markdown-alert-note .markdown-alert-title {
305+
color: #0969da;
306+
}
307+
308+
.markdown-alert.markdown-alert-important {
309+
border-left-color: #8250df;
310+
}
311+
312+
.markdown-alert.markdown-alert-important .markdown-alert-title {
313+
color: #8250df;
314+
}
315+
316+
.markdown-alert.markdown-alert-warning {
317+
border-left-color: #9a6700;
318+
}
319+
320+
.markdown-alert.markdown-alert-warning .markdown-alert-title {
321+
color: #9a6700;
322+
}
323+
324+
.markdown-alert.markdown-alert-tip {
325+
border-left-color: #1a7f37;
326+
}
327+
328+
.markdown-alert.markdown-alert-tip .markdown-alert-title {
329+
color: #1a7f37;
330+
}
331+
332+
.markdown-alert.markdown-alert-caution {
333+
border-left-color: #cf222e;
334+
}
335+
336+
.markdown-alert.markdown-alert-caution .markdown-alert-title {
337+
color: #d1242f;
338+
}
339+
275340
.dark a, .dark a:hover, .dark a:active {
276341
color: rgb(234,130,32);
277342
}

assets/includes/css/styles.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/includes/svg/caution.svg

Lines changed: 1 addition & 0 deletions
Loading

assets/includes/svg/important.svg

Lines changed: 1 addition & 0 deletions
Loading

assets/includes/svg/note.svg

Lines changed: 1 addition & 0 deletions
Loading

assets/includes/svg/tip.svg

Lines changed: 1 addition & 0 deletions
Loading

assets/includes/svg/warning.svg

Lines changed: 1 addition & 0 deletions
Loading

src/Generator.hx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -594,6 +594,22 @@ class Generator {
594594
el.children.resize(0);
595595
el.children.push(new TextNode(section));
596596
}
597+
if ((el.tag == "div" && !el.isEmpty()))
598+
{
599+
for (child in el.children)
600+
{
601+
var childEl:ElementNode = cast child;
602+
if (childEl.attributes.get('class') != null && childEl.attributes.get('class') == "markdown-alert-title") {
603+
var textNode:TextNode = cast childEl.children[0];
604+
var type = textNode.text.toLowerCase();
605+
var img = new ElementNode('img', null);
606+
img.attributes.set('src', 'svg/$type.svg');
607+
img.attributes.set('alt', type);
608+
img.attributes.set('class', 'markdown-alert-image');
609+
childEl.children.insert(0, cast img);
610+
}
611+
}
612+
}
597613

598614
#if test_snippets
599615
// TODO: Move to its own class?

0 commit comments

Comments
 (0)