mdx-features-demo
this post demonstrates the various features available when writing with mdx.
mathematics
mdx supports latex math expressions through katex:
block math
the fourier transform:
inline math
you can also include inline math like within paragraphs.
code highlighting
javascript
function fibonacci(n) {
if (n <= 1) return n;
return fibonacci(n - 1) + fibonacci(n - 2);
}
console.log(fibonacci(10)); // 55
python
def quicksort(arr):
if len(arr) <= 1:
return arr
pivot = arr[len(arr) // 2]
left = [x for x in arr if x < pivot]
middle = [x for x in arr if x == pivot]
right = [x for x in arr if x > pivot]
return quicksort(left) + middle + quicksort(right)
# Example usage
numbers = [3, 6, 8, 10, 1, 2, 1]
print(quicksort(numbers))
rust
fn main() {
let numbers = vec![1, 2, 3, 4, 5];
let doubled: Vec<i32> = numbers
.iter()
.map(|x| x * 2)
.collect();
println!("{:?}", doubled); // [2, 4, 6, 8, 10]
}
tables
| language | paradigm | memory safe |
|---|---|---|
| rust | systems | yes |
| javascript | multi | no |
| python | multi | no |
| haskell | functional | yes |
lists and formatting
unordered lists
- bold text for emphasis
- italic text for subtle emphasis
inline codefor technical termsstrikethroughfor corrections
ordered lists
- first item with detailed explanation
- second item with more content
- third item to complete the set
nested lists
- programming languages
- systems programming
- rust
- c++
- go
- web development
- javascript
- typescript
- python
- systems programming
blockquotes
"the best programs are written so that computing machines can perform them quickly and so that human beings can understand them clearly."
— donald knuth
links and references
check out these resources:
horizontal rules
that's a horizontal rule above this line.
conclusion
mdx provides a powerful way to write content that combines the simplicity of markdown with the flexibility of react components. perfect for technical blogs and documentation!