ここでは Expressive Code によるコードブロックの表示を確認します。
console.log("This code is syntax highlighted!");console.log("Title attribute example");// This code block will show line numbersconsole.log("Greetings from line 2!");console.log("I am on line 3");console.log("Greetings from line 5!");console.log("I am on line 6");// Line 1 - targeted by line number// Line 2// Line 3// Line 4 - targeted by line number// Line 5// Line 6// Line 7 - targeted by range "7-8"// Line 8 - targeted by range "7-8"function demo() { console.log("this line is marked as deleted"); // This line and the next one are marked as inserted console.log("this is the second inserted line");
return "this line uses the neutral default marker type";}this line will be marked as insertedthis line will be marked as deletedthis is a regular linefunction thisIsJavaScript() { // This entire block gets highlighted as JavaScript, // and we can still add diff markers to it! console.log('Old code to be removed') console.log('New and shiny code!')}function getLongString() { return "This is a very long string that will most probably not fit into the available space unless the container is extremely wide";}残り 5 行
// All this boilerplate setup code will be collapsedimport { someBoilerplateEngine } from "@example/some-boilerplate";import { evenMoreBoilerplate } from "@example/even-more-boilerplate";
const engine = someBoilerplateEngine(evenMoreBoilerplate());
// This part of the code will be visible by defaultengine.doSomething(1, 2, 3, calcFn);
function calcFn() { // You can have multiple collapsed sections残り 3 行
const a = 1; const b = 2; const c = a + b;
// This will remain visible console.log(`Calculation result: ${a} + ${b} = ${c}`); return c;}
残り 4 行
// All this code until the end of the block will be collapsed againengine.closeConnection();engine.freeMemory();engine.shutdown({ reason: "End of example boilerplate code" });