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

integrated alert preview #593

Merged
merged 1 commit into from
Jul 29, 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
1 change: 0 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"bierner.markdown-mermaid",
"kejun.markdown-alert",
"astro-build.astro-vscode",
"github.copilot-chat",
"tldraw-org.tldraw-vscode",
Expand Down
89 changes: 89 additions & 0 deletions packages/vscode/markdown.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,92 @@
.vscode-body details.genaiscript pre code.code-line {
font-size: var(--markdown-font-size, 14px);
}

:root {
--color-note: #0969da;
--color-tip: #1a7f37;
--color-warning: #9a6700;
--color-severe: #bc4c00;
--color-caution: #d1242f;
--color-important: #8250df;
}
@media (prefers-color-scheme: dark) {
:root {
--color-note: #2f81f7;
--color-tip: #3fb950;
--color-warning: #d29922;
--color-severe: #db6d28;
--color-caution: #f85149;
--color-important: #a371f7;
}
}

.vscode-body .markdown-alert {
padding: 0.5rem 1rem;
margin-bottom: 16px;
color: inherit;
border-left: 0.25em solid #888;
}

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

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

.vscode-body .markdown-alert .markdown-alert-title {
display: flex;
font-weight: 500;
align-items: center;
line-height: 1;
}

.vscode-body .markdown-alert .markdown-alert-title .octicon {
margin-right: 0.5rem;
display: inline-block;
overflow: visible !important;
vertical-align: text-bottom;
fill: currentColor;
}

.vscode-body .markdown-alert.markdown-alert-note {
border-left-color: var(--color-note);
}

.vscode-body .markdown-alert.markdown-alert-note .markdown-alert-title {
color: var(--color-note);
}

.vscode-body .markdown-alert.markdown-alert-important {
border-left-color: var(--color-important);
}

.vscode-body .markdown-alert.markdown-alert-important .markdown-alert-title {
color: var(--color-important);
}

.vscode-body .markdown-alert.markdown-alert-warning {
border-left-color: var(--color-warning);
}

.vscode-body .markdown-alert.markdown-alert-warning .markdown-alert-title {
color: var(--color-warning);
}

.vscode-body .markdown-alert.markdown-alert-tip {
border-left-color: var(--color-tip);
}

.vscode-body .markdown-alert.markdown-alert-tip .markdown-alert-title {
color: var(--color-tip);
}

.vscode-body .markdown-alert.markdown-alert-caution {
border-left-color: var(--color-caution);
}

.vscode-body .markdown-alert.markdown-alert-caution .markdown-alert-title {
color: var(--color-caution);
}
2 changes: 2 additions & 0 deletions packages/vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
"url": "https://github.com/microsoft/genaiscript"
},
"contributes": {
"markdown.markdownItPlugins": true,
"walkthroughs": [
{
"id": "genaiscript.tutorial",
Expand Down Expand Up @@ -365,6 +366,7 @@
"@vscode/vsce": "^2.31.1",
"assert": "^2.1.0",
"eslint": "^9.7.0",
"markdown-it-github-alerts": "^0.3.0",
"process": "^0.11.10",
"typescript": "5.5.4",
"vscode-uri": "^3.0.8",
Expand Down
8 changes: 8 additions & 0 deletions packages/vscode/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import { activateDocsNotebook } from "./docsnotebook"
import { activateTraceTreeDataProvider } from "./tracetree"
import { registerCommand } from "./commands"
import { EXTENSION_ID, TOOL_NAME } from "../../core/src/constants"
import type MarkdownIt from "markdown-it"
pelikhan marked this conversation as resolved.
Show resolved Hide resolved
import MarkdownItGitHubAlerts from "markdown-it-github-alerts"

export async function activate(context: ExtensionContext) {
const state = new ExtensionState(context)
Expand Down Expand Up @@ -85,4 +87,10 @@ export async function activate(context: ExtensionContext) {

await state.activate()
await activateTestController(state)

return {
extendMarkdownIt: (md: MarkdownIt) => {
return md.use(MarkdownItGitHubAlerts)
},
pelikhan marked this conversation as resolved.
Show resolved Hide resolved
pelikhan marked this conversation as resolved.
Show resolved Hide resolved
}
}
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7669,6 +7669,11 @@ markdown-it-footnote@^4.0.0:
resolved "https://registry.yarnpkg.com/markdown-it-footnote/-/markdown-it-footnote-4.0.0.tgz#02ede0cb68a42d7e7774c3abdc72d77aaa24c531"
integrity sha512-WYJ7urf+khJYl3DqofQpYfEYkZKbmXmwxQV8c8mO/hGIhgZ1wOe7R4HLFNwqx7TjILbnC98fuyeSsin19JdFcQ==

markdown-it-github-alerts@^0.3.0:
version "0.3.0"
resolved "https://registry.yarnpkg.com/markdown-it-github-alerts/-/markdown-it-github-alerts-0.3.0.tgz#acab7db57f4e204c8d1c987403c367738d7026b0"
integrity sha512-qyIuDyfdrVGHhY+E/44yMyNA3ZnayaT/KKT2VgkIz1nmrgiuPkdgPUh4YBZwgJ9VKEGJvGd82Ndrc4oGftrJWg==

markdown-it-mdc@^0.2.5:
version "0.2.5"
resolved "https://registry.yarnpkg.com/markdown-it-mdc/-/markdown-it-mdc-0.2.5.tgz#94ad523f828edb1249bb6c344b719435576a2aa1"
Expand Down