Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: fix rendering of code blocks in list #1401

Merged
merged 3 commits into from
Nov 7, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 38 additions & 38 deletions doc/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ To use **Node-API** in a native module:

1. Add a dependency on this package to `package.json`:

```json
"dependencies": {
"node-addon-api": "*",
}
```
```json
"dependencies": {
"node-addon-api": "*",
}
```

2. Decide whether the package will enable C++ exceptions in the Node-API
wrapper, and reference this package as a dependency in `binding.gyp`.
Expand All @@ -32,51 +32,51 @@ To use **Node-API** in a native module:

To use without C++ exceptions, add the following to `binding.gyp`:

```gyp
'dependencies': [
"<!(node -p \"require('node-addon-api').targets\"):node_addon_api",
],
```
```gyp
'dependencies': [
"<!(node -p \"require('node-addon-api').targets\"):node_addon_api",
],
```

To enable that capability, add an alternative dependency in `binding.gyp`:

```gyp
'dependencies': [
"<!(node -p \"require('node-addon-api').targets\"):node_addon_api_except",
],
```
```gyp
'dependencies': [
"<!(node -p \"require('node-addon-api').targets\"):node_addon_api_except",
],
```

If you decide to use node-addon-api without C++ exceptions enabled, please
consider enabling node-addon-api safe API type guards to ensure the proper
exception handling pattern:
If you decide to use node-addon-api without C++ exceptions enabled, please
consider enabling node-addon-api safe API type guards to ensure the proper
exception handling pattern:

```gyp
'dependencies': [
"<!(node -p \"require('node-addon-api').targets\"):node_addon_api_maybe",
],
```
```gyp
'dependencies': [
"<!(node -p \"require('node-addon-api').targets\"):node_addon_api_maybe",
],
```

4. If you would like your native addon to support OSX, please also add the
tniessen marked this conversation as resolved.
Show resolved Hide resolved
following settings in the `binding.gyp` file:

```gyp
'conditions': [
['OS=="mac"', {
'cflags+': ['-fvisibility=hidden'],
'xcode_settings': {
'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES', # -fvisibility=hidden
}
}]
]
```
following settings in the `binding.gyp` file:

```gyp
'conditions': [
['OS=="mac"', {
'cflags+': ['-fvisibility=hidden'],
'xcode_settings': {
'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES', # -fvisibility=hidden
}
}]
]
```

5. Include `napi.h` in the native module code.
tniessen marked this conversation as resolved.
Show resolved Hide resolved
To ensure only ABI-stable APIs are used, DO NOT include
`node.h`, `nan.h`, or `v8.h`.

```C++
#include "napi.h"
```
```C++
#include "napi.h"
```

At build time, the Node-API back-compat library code will be used only when the
targeted node version *does not* have Node-API built-in.
Expand Down