mirror of
https://github.com/purocean/yn.git
synced 2026-09-01 15:37:16 +08:00
e9731f08a6
Agent-Logs-Url: https://github.com/purocean/yn/sessions/423ca3b8-9674-4d0f-98d1-bc1fd5c33c5d Co-authored-by: purocean <7115690+purocean@users.noreply.github.com>
1.5 KiB
1.5 KiB
Code Line Highlighting Test
This document tests code line highlighting in Yank Note.
Note
: Requires the
@yank-note/extension-code-line-highlightingextension.
Highlight Specific Lines
// Line 1 - highlighted
const express = require('express');
const app = express();
// Line 4 - highlighted
// Line 5 - highlighted
// Line 6 - highlighted
const PORT = 3000;
app.get('/', (req, res) => {
res.send('Hello World!');
// Line 11 - highlighted
});
app.listen(PORT);
Highlight with Data Attribute
# Line 1
import os # Line 2 - highlighted
import sys
def main(): # Line 5 - highlighted
print("Hello") # Line 6 - highlighted
return 0 # Line 7 - highlighted
if __name__ == "__main__":
main()
Highlight a Range
class App {
private name: string;
// Lines 3-8 highlighted
constructor(name: string) {
this.name = name;
}
getName(): string {
return this.name;
}
// Not highlighted
run(): void {
console.log(this.getName());
}
}
Highlight Single Line
fn main() {
let x = 5;
let y = x * 2; // This line is highlighted
println!("y = {}", y);
}
Notes
- Use
{.h:line-numbers}syntax after the language identifier - Alternatively use
{data-line-numbers="..."}format - Supports single lines (
1), ranges (4-6), and combinations (1,4-6,11) - Highlighted lines have a distinct background color