@@ -137,7 +137,7 @@ function getFoo(obj) {
137137}
138138```
139139
140- ``` c++
140+ ``` cpp
141141v8::Local<v8::Value> GetFoo (v8::Local< v8::Context > context,
142142 v8::Local< v8::Object > obj) {
143143 v8::Isolate* isolate = context->GetIsolate();
@@ -168,7 +168,7 @@ See [exception handling][] for more information about the usage of `.To()`,
168168If it is known that a `Local<Value>` refers to a more specific type, it can
169169be cast to that type using `.As<...>()`:
170170
171- ```c++
171+ ```cpp
172172v8::Local<v8::Value> some_value;
173173// CHECK() is a Node.js utilitity that works similar to assert().
174174CHECK(some_value->IsUint8Array());
@@ -201,7 +201,7 @@ alive even if no other objects refer to them. Weak global handles do not do
201201that, and instead optionally call a callback when the object they refer to
202202is garbage-collected.
203203
204- ``` c++
204+ ``` cpp
205205v8::Global<v8::Object> reference;
206206
207207void StoreReference (v8::Isolate* isolate, v8::Local< v8::Object > obj) {
@@ -329,7 +329,7 @@ The platform can be accessed through `isolate_data->platform()` given an
329329C++ functions exposed to JS follow a specific signature. The following example
330330is from `node_util.cc`:
331331
332- ```c++
332+ ```cpp
333333void ArrayBufferViewHasBuffer(const FunctionCallbackInfo<Value>& args) {
334334 CHECK(args[0]->IsArrayBufferView());
335335 args.GetReturnValue().Set(args[0].As<ArrayBufferView>()->HasBuffer());
@@ -351,7 +351,7 @@ floating-point number or a `Local<Value>` to set the return value.
351351Node.js provides various helpers for building JS classes in C++ and/or attaching
352352C++ functions to the exports of a built-in module:
353353
354- ``` c++
354+ ``` cpp
355355void Initialize (Local<Object > target,
356356 Local<Value > unused,
357357 Local<Context > context,
@@ -473,7 +473,7 @@ to perform further calls to APIs that return `Maybe`s.
473473A typical pattern for dealing with APIs that return `Maybe` and `MaybeLocal` is
474474using `.ToLocal()` and `.To()` and returning early in case there is an error:
475475
476- ```c++
476+ ```cpp
477477// This could also return a v8::MaybeLocal<v8::Number>, for example.
478478v8::Maybe<double> SumNumbers(v8::Local<v8::Context> context,
479479 v8::Local<v8::Array> array_of_integers) {
@@ -642,7 +642,7 @@ A helper for this is the `ASSIGN_OR_RETURN_UNWRAP` macro that returns from the
642642current function if unwrapping fails (typically that means that the ` BaseObject `
643643has been deleted earlier).
644644
645- ``` c++
645+ ``` cpp
646646void Http2Session::Request (const FunctionCallbackInfo<Value >& args) {
647647 Http2Session* session;
648648 ASSIGN_OR_RETURN_UNWRAP(&session, args.Holder());
@@ -730,7 +730,7 @@ queues once it returns.
730730Before calling `MakeCallback()`, it is typically necessary to enter both a
731731`HandleScope` and a `Context::Scope`.
732732
733- ```c++
733+ ```cpp
734734void StatWatcher::Callback(uv_fs_poll_t* handle,
735735 int status,
736736 const uv_stat_t* prev,
@@ -822,7 +822,7 @@ The `Utf8Value`, `TwoByteValue` (i.e. UTF-16 value) and `BufferValue`
822822inherit from this class and allow accessing the characters in a JavaScript
823823string this way.
824824
825- ``` c++
825+ ``` cpp
826826static void Chdir (const FunctionCallbackInfo<Value >& args) {
827827 Environment* env = Environment::GetCurrent(args);
828828 // ...
0 commit comments