Skip to content

Commit f6388b8

Browse files
authored
Merge branch 'main' into add-versions-fetch
2 parents 0f91354 + 515f4f2 commit f6388b8

File tree

5 files changed

+22
-5
lines changed

5 files changed

+22
-5
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ Example: `{subs}`wget elasticsearch-{{version}}.tar.gz``
6262
- `{image}` - Images with alt text and sizing options
6363
- `{carousel}` - Image carousels (supports `:max-height:`)
6464
- `{diagram}` - Various diagram types (mermaid, d2, graphviz, plantuml, etc.)
65+
- `{math}` - Mathematical expressions using LaTeX syntax (supports `:label:` for cross-referencing)
6566

6667
### Content inclusion
6768
- `{include}` - Include content from other files

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@
1616
],
1717
"icon": "images/icon.png",
1818
"activationEvents": [
19-
"onLanguage:markdown",
20-
"onStartupFinished"
19+
"onLanguage:markdown"
2120
],
2221
"main": "./out/extension.js",
2322
"browser": "./out/extension-web.js",

src/directives.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,13 @@ export const DIRECTIVES: readonly DirectiveDefinition[] = [
145145
template: ':::{csv-include} _snippets/sample-data.csv\n:caption: Sample user data from the database\n:::',
146146
description: 'Include and render CSV files as formatted tables.'
147147
},
148+
{
149+
name: 'math',
150+
hasArgument: false,
151+
parameters: ['label'],
152+
template: ':::{math}\n:label: equation-label\nE = mc^2\n:::',
153+
description: 'Render mathematical expressions using LaTeX syntax. Mathematical expressions are rendered client-side using KaTeX for fast, accurate display.'
154+
},
148155
];
149156

150157
export const PARAMETER_VALUES: { [key: string]: string[] } = {

src/extension.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,17 @@ export function activate(context: vscode.ExtensionContext): void {
355355
function applyColorCustomizations(): void {
356356
const config = vscode.workspace.getConfiguration('editor');
357357
const currentCustomizations = config.get('tokenColorCustomizations') as Record<string, unknown> || {};
358+
const existingRules = (currentCustomizations.textMateRules as Array<{ scope?: string }>) || [];
359+
360+
// Check if our rules are already applied by looking for a known elastic scope
361+
const elasticRulesAlreadyApplied = existingRules.some(
362+
rule => rule.scope && rule.scope.includes('.elastic')
363+
);
364+
365+
if (elasticRulesAlreadyApplied) {
366+
// Rules already exist, skip the expensive settings write
367+
return;
368+
}
358369

359370
// Define our custom color rules
360371
const elasticRules = [
@@ -435,11 +446,9 @@ function applyColorCustomizations(): void {
435446
}
436447
];
437448

438-
// Merge with existing rules
439-
const existingRules = (currentCustomizations.textMateRules as unknown[]) || [];
449+
// Merge with existing rules and apply (only on first activation)
440450
const newRules = [...existingRules, ...elasticRules];
441451

442-
// Apply the customizations
443452
config.update('tokenColorCustomizations', {
444453
...currentCustomizations,
445454
textMateRules: newRules

src/products.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
*/
1919

2020
export const PRODUCTS: Record<string, string> = {
21+
'agent-builder': 'Elastic Agent Builder',
2122
'apm': 'APM',
2223
'apm-agent': 'APM Agent',
2324
'apm-agent-dotnet': 'APM .NET Agent',

0 commit comments

Comments
 (0)