@@ -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,
@@ -409,7 +409,7 @@ constant string, in order to disambiguate it from other classes of this type,
409409and which could e.g. match the binding’s name (in the example above, that would
410410be `cares_wrap`).
411411
412- ```c++
412+ ```cpp
413413// In the HTTP parser source code file:
414414class BindingData : public BaseObject {
415415 public:
@@ -523,7 +523,7 @@ to perform further calls to APIs that return `Maybe`s.
523523A typical pattern for dealing with APIs that return ` Maybe ` and ` MaybeLocal ` is
524524using ` .ToLocal() ` and ` .To() ` and returning early in case there is an error:
525525
526- ``` c++
526+ ``` cpp
527527// This could also return a v8::MaybeLocal<v8::Number>, for example.
528528v8::Maybe<double > SumNumbers (v8::Local< v8::Context > context,
529529 v8::Local< v8::Array > array_of_integers) {
@@ -692,7 +692,7 @@ A helper for this is the `ASSIGN_OR_RETURN_UNWRAP` macro that returns from the
692692current function if unwrapping fails (typically that means that the `BaseObject`
693693has been deleted earlier).
694694
695- ```c++
695+ ```cpp
696696void Http2Session::Request(const FunctionCallbackInfo<Value>& args) {
697697 Http2Session* session;
698698 ASSIGN_OR_RETURN_UNWRAP(&session, args.Holder());
@@ -780,7 +780,7 @@ queues once it returns.
780780Before calling ` MakeCallback() ` , it is typically necessary to enter both a
781781` HandleScope ` and a ` Context::Scope ` .
782782
783- ``` c++
783+ ``` cpp
784784void StatWatcher::Callback (uv_fs_poll_t* handle,
785785 int status,
786786 const uv_stat_t* prev,
@@ -872,7 +872,7 @@ The `Utf8Value`, `TwoByteValue` (i.e. UTF-16 value) and `BufferValue`
872872inherit from this class and allow accessing the characters in a JavaScript
873873string this way.
874874
875- ```c++
875+ ```cpp
876876static void Chdir(const FunctionCallbackInfo<Value>& args) {
877877 Environment* env = Environment::GetCurrent(args);
878878 // ...
0 commit comments