Markdown
Code Blocks
This documentation is for the preview version of the Dev Portal. If you are not part of the preview program, please refer to the current Dev Portal docs.
Dev Portal supports code blocks in Markdown using the Prism.js syntax highlighting library.
Syntax Highlighting
Code blocks are text blocks wrapped around by strings of 3 backticks. You may check out this reference for the specifications of MDX.
```js console.log("Every repo must come with a mascot."); ```markdown
The code block above will render as:
console.log("Every repo must come with a mascot.");js
You can also use the SyntaxHighlight
component to render code blocks.
You can add a title to code blocks by adding a title attribute after the backticks:
```tsx title="hello.tsx" console.log("Hello, World!"); ```md
hello.tsx
console.log("Hello, World!");tsx
Supported Languages
Currently, Dev Portal supports the following languages for syntax highlighting:
- Markup -
markup
,html
,xml
,svg
,mathml
,ssml
,atom
,rss
- Ruby -
ruby
,rb
- Bash -
bash
,sh
,shell
- JSON -
json
,webmanifest
- Java -
java
- C# -
csharp
,cs
,dotnet
- Objective-C -
objectivec
,objc
- Markdown -
markdown
,md
- JavaScript -
javascript
,js
,jsx
- TypeScript -
typescript
,ts
,tsx
Language customization is coming soon! See #86