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

Add support for github style markdown alerts #28

Merged
merged 1 commit into from
Sep 23, 2024
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
60 changes: 60 additions & 0 deletions _sass/alerts.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
blockquote.markdown-alert, .markdown-alert {
padding: var(--base-size-8) var(--base-size-16);
margin-bottom: var(--base-size-16);
color: inherit;
border-left: .25em solid var(--borderColor-default, var(--color-border-default));
}

.markdown-alert>:first-child {
margin-top: 0;
}

.markdown-alert>:last-child {
margin-bottom: 0;
}

.markdown-alert .markdown-alert-title {
display: flex;
font-weight: var(--base-text-weight-medium, 500);
align-items: center;
line-height: 1;
}
.markdown-alert.markdown-alert-note {
border-left-color: var(--borderColor-accent-emphasis, var(--color-accent-emphasis));
}

.markdown-alert.markdown-alert-note .markdown-alert-title {
color: var(--fgColor-accent, var(--color-accent-fg));
}

.markdown-alert.markdown-alert-important {
border-left-color: var(--borderColor-done-emphasis, var(--color-done-emphasis));
}

.markdown-alert.markdown-alert-important .markdown-alert-title {
color: var(--fgColor-done, var(--color-done-fg));
}

.markdown-alert.markdown-alert-warning {
border-left-color: var(--borderColor-attention-emphasis, var(--color-attention-emphasis));
}

.markdown-alert.markdown-alert-warning .markdown-alert-title {
color: var(--fgColor-attention, var(--color-attention-fg));
}

.markdown-alert.markdown-alert-tip {
border-left-color: var(--borderColor-success-emphasis, var(--color-success-emphasis));
}

.markdown-alert.markdown-alert-tip .markdown-alert-title {
color: var(--fgColor-success, var(--color-success-fg));
}

.markdown-alert.markdown-alert-caution {
border-left-color: var(--borderColor-danger-emphasis, var(--color-danger-emphasis));
}

.markdown-alert.markdown-alert-caution .markdown-alert-title {
color: var(--fgColor-danger, var(--color-danger-fg));
}
4 changes: 3 additions & 1 deletion _sass/jekyll-v4-theme-primer.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
@import "@primer/css/markdown/index.scss";
@import "@primer/css/buttons/index.scss";
@import "@primer/css/tooltips/index.scss";

@import "alerts.scss";

[data-color-mode=light][data-light-theme*=light],
[data-color-mode=dark][data-dark-theme*=light] {
@import "rouge-light.scss";
Expand Down Expand Up @@ -47,4 +50,3 @@ clipboard-copy {
height: 28px;
width: 28px;
}

17 changes: 17 additions & 0 deletions index.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,23 @@ end
<dd>Green</dd>
</dl>

### Here are GitHub style alerts:

> [!NOTE]
> Useful information that users should know, even when skimming content.

> [!TIP]
> Helpful advice for doing things better or more easily.

> [!IMPORTANT]
> Key information users need to know to achieve their goal.

> [!WARNING]
> Urgent info that needs immediate user attention to avoid problems.

> [!CAUTION]
> Advises about risks or negative outcomes of certain actions.

```
Long, single-line code blocks should not wrap. They should horizontally scroll if they are too long. This line should be long enough to demonstrate this.
```
Expand Down
1 change: 1 addition & 0 deletions jekyll-v4-theme-primer.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Gem::Specification.new do |s|
s.required_ruby_version = ">= 2.4.0"

s.add_dependency "jekyll", ">= 4.0", "< 5.0"
s.add_runtime_dependency "jekyll-github-alerts", "~> 0.1"
s.add_runtime_dependency "jekyll-github-metadata", "~> 2.16"
s.add_runtime_dependency "jekyll-seo-tag", "~> 2.0"
s.add_runtime_dependency "jekyll-sass-converter", "~> 3.0"
Expand Down