Skip to content
BR_

How content is written

Front matter, MDX components and the code block features available to authors.

On this page

Content lives under content/<kind>/<slug>/<locale>.mdx. The slug is the folder, the locale is the file name, so a translation is a new file next to the English one.

Front matter#

Every kind has a typed schema that is checked at build time.

KindRequired fields
Notetitle, summary, date, tags
Projecttitle, summary, date, domains
Documentation pagetitle, summary, updated
Labtitle, summary, date

Code blocks#

Blocks are highlighted at build time, so they cost no JavaScript in the browser. Each block has a copy button, an optional title and optional line highlighting.

blink.c
#include <stdint.h>
 
static volatile uint32_t *const GPIO_ODR = (uint32_t *)0x40020014u;
 
void toggle_led(void) {
    *GPIO_ODR ^= (1u << 5);
}
checksum.py
def crc8(data: bytes, poly: int = 0x07) -> int:
    crc = 0
    for byte in data:
        crc ^= byte
        for _ in range(8):
            crc = ((crc << 1) ^ poly) & 0xFF if crc & 0x80 else (crc << 1) & 0xFF
    return crc
parse.rs
fn parse_frame(buf: &[u8]) -> Option<(u16, &[u8])> {
    let (head, payload) = buf.split_at_checked(2)?;
    let id = u16::from_be_bytes([head[0], head[1]]);
    Some((id, payload))
}
hello_1.0.bb
SUMMARY = "Hello recipe"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
 
SRC_URI = "file://hello.c"
S = "${WORKDIR}"
 
do_compile() {
    ${CC} ${CFLAGS} ${LDFLAGS} hello.c -o hello
}
 
do_install() {
    install -d ${D}${bindir}
    install -m 0755 hello ${D}${bindir}
}
 
FILES:${PN} += "${bindir}/hello"
board.dts
/dts-v1/;
 
/ {
    model = "Example board";
    compatible = "vendor,example";
 
    leds {
        compatible = "gpio-leds";
        status_led: led-0 {
            gpios = <&gpio1 5 0>;
            label = "status";
        };
    };
};
bitbake core-image-minimal && bitbake -c populate_sdk core-image-minimal
- INHERIT += "cve-check"
+ INHERIT += "create-spdx cve-check"

Diagrams and demos#

Interactive demos are React components registered for MDX, client-side by default. The register decoder is the first one.