meshtastic/docs/development/documentation/style-guides/markdown-features.mdx

84 lines
1.7 KiB
Plaintext
Raw Normal View History

2022-04-07 02:59:15 -07:00
---
2022-11-04 10:06:45 -07:00
id: markdown
title: Markdown Features
2022-04-07 03:04:17 -07:00
sidebar_label: Markdown Features
2022-04-07 02:59:15 -07:00
---
2023-01-19 05:01:57 -08:00
import { Dark, Light } from "/src/components/ColorMode";
2022-04-07 02:59:15 -07:00
## Overview
We have developed several [React](https://reactjs.org/) components for assisting with writing documentation.
## Features
### Light/Dark Mode Switch
2023-01-19 05:01:57 -08:00
#### Usage
2022-04-07 02:59:15 -07:00
```jsx
import { Dark, Light } from '/src/components/ColorMode';
<Dark>
<p>Dark</p>
</Dark>
<Light>
<p>Light</p>
</Light>
```
2023-01-19 05:01:57 -08:00
#### Demo
2022-04-07 02:59:15 -07:00
<Dark>
<div className="not-prose rounded-lg bg-primary shadow-md">
<p className="p-2 text-lg font-medium">This is only shown in dark mode.</p>
<img
src="https://picsum.photos/id/101/600/200"
className="w-full rounded-lg shadow-md"
/>
</div>
</Dark>
<Light>
<div className="not-prose rounded-lg border bg-primary shadow-md">
2022-04-07 03:04:17 -07:00
<p className="p-2 text-lg font-medium">This is only shown in light mode.</p>
2022-04-07 02:59:15 -07:00
<img
src="https://picsum.photos/id/1028/600/200"
className="w-full rounded-lg shadow-md"
/>
</div>
</Light>
2022-04-08 07:29:34 -07:00
### Code Blocks
2023-01-19 05:01:57 -08:00
#### Usage
2022-04-08 07:29:34 -07:00
Always specify the language used directly after the start of the code block (```).
:::note
For command line examples, please use `shell` and not any of the other aliases.
:::
for further information please see the relevant [Docusaurus page](https://docusaurus.io/docs/markdown-features/code-blocks)
````
```ts title="Demo"
export const typedArrayToBuffer = (array: Uint8Array): ArrayBuffer => {
return array.buffer.slice(
array.byteOffset,
array.byteLength + array.byteOffset
);
};
```
````
2023-01-19 05:01:57 -08:00
#### Demo
2022-04-08 07:29:34 -07:00
```ts title="Demo"
export const typedArrayToBuffer = (array: Uint8Array): ArrayBuffer => {
return array.buffer.slice(
array.byteOffset,
2023-01-19 05:01:57 -08:00
array.byteLength + array.byteOffset
2022-04-08 07:29:34 -07:00
);
};
```