이 글은 코드 블록 UI 옵션 데모입니다.
# title: Default (linenos on, start 1)
# line: 1
#include <iostream>
int main() {
std::cout << "Hello" << std::endl;
return 0;
}
# title: Offset start=100
# line: 100
int add(int a, int b) {
return a + b;
}
int main() {
int x = add(1, 2);
return x;
}
# title: Line numbers off
struct Vec2 {
float x;
float y;
};
int main() {
Vec2 v{1.0f, 2.0f};
return 0;
}
# title: Custom start=56
# line: 56
// Demonstrate that the header language label can be overridden.
class Foo {
public:
void run() const {}
};
Inline lineno markers example
This example shows how you can place inline line-number markers inside the code to change numbering mid-block. The marker syntax now requires # at the line start:
# title: My Title# line: Nto set the next line’s number# nolineto suspend numbering until the next# line:# ellipsisto show...in the gutter
The marker line itself does not receive a line number.
# title: Inline lineno demo
# collapse
// noline and ellipsis markers are shown below to demonstrate behavior
#include <iostream>
int main() {
std::cout << "First section" << std::endl; // regular lines start at 1
}
# noline
# ellipsis
# line: 100
// now numbering should continue from 100
int f() { return 42; }
# noline
# ellipsis
# line: 200
// now numbering should continue from 200
int g() { return 43; }