Code

Code blocks in Markdown
Updated 12 Sept 2021

Code blocks

import React from 'react'
import Highlight, { defaultProps } from 'prism-react-renderer'
export default ({ children, className }) => {
const language = className.replace(/language-/, '')
return (
<Highlight {...defaultProps} code={children.trim()} language={language}>
{({ className, style, tokens, getLineProps, getTokenProps }) => (
<code className={`${className} w-full p-4 rounded`} style={style}>
{tokens.map((line, i) => (
<div key={i} {...getLineProps({ line, key: i })}>
{line.map((token, key) => (
<span key={key} {...getTokenProps({ token, key })} />
))}
</div>
))}
</code>
)}
</Highlight>
)
}

Code in a grid

// C++
int main(void) {
std::cout << "Hello world!" << std::endl;
return 0;
}
# Python
print('Hello world!')
// JavaScript
console.log('Hello world!')
# Bash
echo "hello world"
# YAML
- msg: 'hello world'
<!-- Markdown -->
# Hello world
# Docker
RUN echo "Hello world"
# CMake
message(STATUS "Hello world")
Hello world in languages used in NUbook
General
Glossary
NUbots acknowledges the traditional custodians of the lands within our footprint areas: Awabakal, Darkinjung, Biripai, Worimi, Wonnarua, and Eora Nations. We acknowledge that our laboratory is situated on unceded Pambalong land. We pay respect to the wisdom of our Elders past and present.
Copyright © 2024 NUbots - CC-BY-4.0
Deploys by Netlify