Skip to content

Commit 0542fc3

Browse files
author
Tristan Floch
committed
Improve code blocks with buttons, highlights and filenames
1 parent 252baa6 commit 0542fc3

2 files changed

Lines changed: 18 additions & 12 deletions

File tree

docs/guides/howto.md

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
EosSdkRpc is an agent built on top of our EosSdk that uses gRPC as a mechanism to provide remote access to the SDK.
66

7-
This agent is present in development versions of EOS, and is currently enabled via the "daemon" command set - starting in the 4.29 release a first-class CLI was created "management api eos-sdk-rpc" and is now the recommended configuration method. The gRPC interface that the agent supports closely matches the interface provided by EosSdk, and the intent is that the .proto interface can be publicly supported. As well as potentially allowing for remote access, using protobuf to specify the interface isolates customer code from the Linux ABI issues that come with building C++ applications on different compiler, libc, and kernel versions.
7+
This agent is present in development versions of EOS, and is currently enabled via the "daemon" command set - starting in the 4.29 release a first-class CLI was created `management api eos-sdk-rpc` and is now the recommended configuration method. The gRPC interface that the agent supports closely matches the interface provided by EosSdk, and the intent is that the .proto interface can be publicly supported. As well as potentially allowing for remote access, using protobuf to specify the interface isolates customer code from the Linux ABI issues that come with building C++ applications on different compiler, libc, and kernel versions.
88

9-
The default listen point for the agent is localhost:9543 but this can be changed to allow external access. Only encrypted access is supported for EosSdkRpc agents configured via the management api eos-sdk-rpc CLI. An ACL should be used to limit the hosts that have access to the agent.
9+
The default listen point for the agent is `localhost:9543` but this can be changed to allow external access. Only encrypted access is supported for EosSdkRpc agents configured via the `management api eos-sdk-rpc` CLI. An ACL should be used to limit the hosts that have access to the agent.
1010

1111
The API mirroring is intended to be modular in the same fashion as the SDK itself. Each proto file mirrors one specific SDK module and the RPC definitions and messages also aim to be as close as possible to the original SDK API call, in an attempt to make the learning gap as small as possible.
1212

@@ -223,8 +223,8 @@ This will result in a directory proto being created under our root. Now we have
223223

224224
CMake has a good integration with Protobuf and already provides a convenient way to generate C++ files and headers. Unfortunately there is no official solution for gRPC yet. The file described below is a helper module to allow generation of gRPC C++ files with the same convenience as protobuf.
225225

226-
```cmake
227-
## gRPC.cmake - a convenient gRPC proto file generator for CMake
226+
```cmake title="gRPC.cmake"
227+
## A convenient gRPC proto file generator for CMake
228228
229229
find_library( grpc_LIBRARY grpc REQUIRED )
230230
find_library( grpcpp_LIBRARY grpc++ REQUIRED )
@@ -262,8 +262,7 @@ endfunction()
262262

263263
Now we can start our own `CMakeLists.txt`:
264264

265-
```cmake
266-
# CMakeLists.txt
265+
```cmake title="CMakeLists.txt"
267266
cmake_minimum_required( VERSION 3.6 )
268267
project( eosrpcclient )
269268
@@ -309,8 +308,7 @@ target_link_libraries( eosrpcclient
309308

310309
We can now add the client code (update the address on `CreateChannel`):
311310

312-
```c++
313-
// -- client.cc
311+
```c++ title="client.cc"
314312
#include <grpc/grpc.h>
315313
#include <grpcpp/grpcpp.h>
316314
#include <grpcpp/client_context.h>
@@ -374,9 +372,9 @@ Response to "show version": {"imageFormatVersion": "1.0", "uptime": 1506.9400000
374372

375373
### Expanding our previous example: creating and removing one EVPN route
376374

377-
Now, let's expand our example to use the SDK (ip_route) to add and remove a single static route. The example below builds on top of the previous. The differences are marked in bold.
375+
Now, let's expand our example to use the SDK (ip_route) to add and remove a single static route. The example below builds on top of the previous.
378376

379-
```cmake
377+
```cmake title="CMakeLists.txt" hl_lines="12 18 24-27 47"
380378
cmake_minimum_required( VERSION 3.6 )
381379
project( eosrpcclient )
382380
@@ -429,8 +427,7 @@ target_link_libraries( eosrpcclient
429427

430428
And the updated code, with some added functions:
431429

432-
```c++
433-
// -- client.cc
430+
```c++ title="client.cc"
434431
#include <grpc/grpc.h>
435432
#include <grpcpp/grpcpp.h>
436433
#include <grpcpp/client_context.h>

mkdocs.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@ markdown_extensions:
2323
- admonition
2424
- pymdownx.details
2525
- pymdownx.superfences
26+
- pymdownx.highlight:
27+
anchor_linenums: true
28+
line_spans: __span
29+
pygments_lang_class: true
30+
- pymdownx.inlinehilite
31+
- pymdownx.snippets
32+
- pymdownx.superfences
2633
theme:
2734
name: material
2835
language: en
@@ -34,6 +41,8 @@ theme:
3441
- navigation.instant # toc follows scrolling
3542
- navigation.top # back to top button on scrolling down
3643
- navigation.footer # previous and next buttons
44+
- content.code.copy # copy button in code blocks
45+
- content.code.select # line selection button code blocks
3746
palette:
3847
- media: "(prefers-color-scheme: light)"
3948
scheme: default

0 commit comments

Comments
 (0)