Skip to content

Commit 9c22b0a

Browse files
a-haritilizokm
andauthored
chore: Update contributing docs (#9456)
* chore: clean up Alert components and improve corresponding docs * chore: document hightlighting and diffs in Code Blocks * chore:remove outdated references to current platform inference from query string * chore: udpate @Inject variables docs * Update docs/contributing/pages/components.mdx * Update docs/contributing/pages/components.mdx * Update docs/contributing/pages/components.mdx * Update docs/contributing/pages/variables.mdx * Update docs/contributing/pages/variables.mdx --------- Co-authored-by: Liza Mock <liza.mock@sentry.io>
1 parent b0c5b19 commit 9c22b0a

File tree

3 files changed

+58
-19
lines changed

3 files changed

+58
-19
lines changed

docs/contributing/pages/components.mdx

Lines changed: 50 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ This is an alert
2424
Attributes:
2525

2626
- `title` (string)
27-
- `level` (string)
28-
- `dismiss` (boolean)
27+
- `level` (string: `'info' | 'warning' | 'danger' | 'success'`)
2928

3029
Use this for these types of content:
3130

@@ -65,6 +64,52 @@ var foo = "bar";
6564
```
6665
````
6766

67+
You can bring attention to specific lines in a code block using the `{fromLineA-toLineB}` for ranges,
68+
or `{lineA,lineB}` for specific lines (or a combination of the two):
69+
70+
```javascript {2} {tabTitle:Example}
71+
function foo() {
72+
let lookat = "me";
73+
return "bar";
74+
}
75+
```
76+
77+
````markdown {tabTitle:Source}
78+
```javascript {2}
79+
function foo() {
80+
let lookat = "me";
81+
return "bar";
82+
}
83+
```
84+
````
85+
86+
You can also highlight diffs using the `diff` language:
87+
88+
````markdown {tabTitle:Example}
89+
```diff
90+
- minus one
91+
+ plus one
92+
```
93+
````
94+
If you want to preserve syntax highlighting, you can add `diff` metadata to any code block
95+
then annotate the diff with `+` and `-`:
96+
97+
```javascript {diff} {tabTitle:Example}
98+
function foo() {
99+
- return "bar";
100+
+ return "baz";
101+
}
102+
```
103+
104+
````markdown {tabTitle:Source}
105+
```javascript {diff}
106+
function foo() {
107+
- return "bar";
108+
+ return "baz";
109+
}
110+
```
111+
````
112+
68113
## ConfigKey
69114

70115
Render a heading with a configuration key in the correctly cased format for a given platform.
@@ -86,7 +131,7 @@ Description of send-default-pii
86131
Attributes:
87132

88133
- `name` (string)
89-
- `platform` (string) - defaults to the `platform` value from the page context or querystring
134+
- `platform` (string) - defaults to the `platform` value from the page context
90135
- `supported` (string[])
91136
- `notSupported` (string[])
92137

@@ -141,14 +186,12 @@ Render an include based on the currently selected `platform` in context.
141186
Attributes:
142187

143188
- `includePath` (string) - the subfolder within `/includes` to map to
144-
- `platform` (string) - defaults to the `platform` value from the page context or querystring
189+
- `platform` (string) - defaults to the `platform` value from the page context
145190

146191
Some notes:
147192

148193
- When the current platform comes from the page context and no matching include is found, the content will be hidden.
149194

150-
- When the current platform comes from the page context path (not the querystring) the platform selector dropdown will be hidden.
151-
152195
- Similar to `PlatformSection`, you can embed content in the block which will render _before_ the given include, but only when an include is available.
153196

154197
- A file named `_default` will be used if no other content matches.
@@ -195,7 +238,7 @@ Something that applies to all platforms, but not javascript or node.
195238

196239
Attributes:
197240

198-
- `platform` (string) - defaults to the `platform` value from the page context or querystring
241+
- `platform` (string) - defaults to the `platform` value from the page context
199242
- `supported` (string[])
200243
- `notSupported` (string[])
201244
- `noGuides` (boolean) - hide this on all guides (takes precedence over `supported`/`notSupported`)

docs/contributing/pages/variables.mdx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ title: Markdown Variables
33
noindex: true
44
---
55

6-
A transformation is exposed to both Markdown and MDX files which supports processing variables in a Django/Jekyll-style way. The variables available are globally scoped and configured within `gatsby-config.js` (via `gatsby-remark-variables`).
6+
A transformation is exposed to both Markdown and MDX files which supports processing variables in a Django/Jekyll-style way.
7+
The variables available are globally scoped and configured within `remark-variables.js`.
78

89
For example:
910

@@ -15,9 +16,11 @@ JavaScript SDK: {{@inject packages.version("sentry.javascript.browser") }}
1516
JavaScript SDK: {{\@inject packages.version("sentry.javascript.browser") }}
1617
```
1718

18-
In this case, we expose `packages` as an accessor in the package registry which is why there is a `packages.version` function available. Additional, we expose a default context variable of `page` which contains the frontmatter of the given markdown node. For example, `{{\@inject page.title }}`.
19+
In this case, we expose `packages` as an accessor in the package registry, which is why there's a `packages.version` function available. Additionally, we expose a default context variable of `page`, which contains the frontmatter of the given markdown node. For example, `{{\@inject page.title }}`.
1920

20-
When a variable call is invalid (or errors), or doesn't match something in the known scope, it will produce an error. If you need to escape an expression you can add a leading `\` to the `@inject`.
21+
When a variable call is invalid (or errors), or doesn't match something in the known scope, it will produce an error message in the output in development mode. It will force the build to fail in production.
22+
23+
To escape an expression add a leading `\` to the `@inject`.
2124

2225
## `packages`
2326

src/components/alert.tsx

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,11 @@
22

33
type Props = {
44
children?: any;
5-
deepLink?: string;
6-
dismiss?: boolean;
75
level?: 'info' | 'warning' | 'danger' | 'success' | '';
86
title?: string;
97
};
108

11-
export function Alert({title, children, level, deepLink, dismiss = false}: Props) {
9+
export function Alert({title, children, level}: Props) {
1210
let className = 'alert';
1311
if (level) {
1412
className += ` alert-${level}`;
@@ -17,12 +15,7 @@ export function Alert({title, children, level, deepLink, dismiss = false}: Props
1715
className += ' markdown-text-only';
1816
}
1917
return (
20-
<div className={className} role="alert" id={deepLink}>
21-
{dismiss && (
22-
<button type="button" className="close" data-dismiss="alert" aria-label="Close">
23-
<span aria-hidden="true">&times;</span>
24-
</button>
25-
)}
18+
<div className={className} role="alert">
2619
{title && <h5 className="no_toc">{title}</h5>}
2720
<div className="alert-body content-flush-bottom">{children}</div>
2821
</div>

0 commit comments

Comments
 (0)