Skip to content

Commit bba9ee0

Browse files
committed
fix: markdown * parsing
1 parent e805684 commit bba9ee0

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

docs/docs/markdown/filters-and-views.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ In the self-hosted version you can configure the system views by setting the `SY
5757
```
5858

5959
The JSON structure is an object with key value pairs.
60-
- The keys are context names, therefore you can have different presets per environment. - The context names accept wildcards. ` * ` is a catch-all rule and `dev4` matches one cluster, while `dev*` matches all cluster names starting with dev.
60+
- The keys are context names, therefore you can have different presets per environment. - The context names accept wildcards. `*` is a catch-all rule and `dev4` matches one cluster, while `dev*` matches all cluster names starting with dev.
6161
- The values of the key-value pairs are arrays of views.
6262
- A view has an id and a label and an array of filtes.
6363
- The best way to create the views array is to copy views from the browser local storage. Define a custom view on the UI, then copy the JSON from the local storage with the browser developer toolbar.

docs/product.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,16 @@
166166
return '<a class="dim" href="' + urlEsc + '" target="_blank" rel="noopener noreferrer">' + text + '</a>';
167167
});
168168
// Basic emphasis: *text* → <em>text</em>
169-
const withEmphasis = withLinks.replace(/\*([^*]+)\*/g, (_m, em) => {
170-
return '<em>' + em + '</em>';
171-
});
169+
//
170+
// Be conservative: only treat asterisks as emphasis markers when they are
171+
// surrounded by whitespace/punctuation. This avoids "eating" wildcard
172+
// asterisks like `"*": []` or `dev*` by accidentally matching across a line.
173+
const withEmphasis = withLinks.replace(
174+
/(^|[\s(])\*([^\s*](?:[^*]*?[^\s*])?)\*(?=[\s).,!?:;]|$)/g,
175+
(_m, prefix, em) => {
176+
return prefix + '<em>' + em + '</em>';
177+
}
178+
);
172179
const withCode = withEmphasis.replace(/`([^`]+)`/g, (_m, code) => {
173180
// Inline code: use break-all so the code wraps mid-word rather than
174181
// being pushed to a new line as a whole unit.

0 commit comments

Comments
 (0)