8000 Update README.md (#171) · web3-geek/protobuf-javascript@8730ba5 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8730ba5

Browse files
authored
Update README.md (protocolbuffers#171)
add highlighting code
1 parent 566f359 commit 8730ba5

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,13 @@ For Closure imports, `protoc` will generate a single output file
9292
(`myproto_libs.js` in this example). The generated file will `goog.provide()`
9393
all of the types defined in your .proto files. For example, for the unit
9494
tests the generated files contain many `goog.provide` statements like:
95-
95+
```js
9696
goog.provide('proto.google.protobuf.DescriptorProto');
9797
goog.provide('proto.google.protobuf.DescriptorProto.ExtensionRange');
9898
goog.provide('proto.google.protobuf.DescriptorProto.ReservedRange');
9999
goog.provide('proto.google.protobuf.EnumDescriptorProto');
100100
goog.provide('proto.google.protobuf.EnumOptions');
101-
101+
```
102102
The generated code will also `goog.require()` many types in the core library,
103103
and they will require many types in the Google Closure library. So make sure
104104
that your `goog.provide()` / `goog.require()` setup can find all of your
@@ -107,11 +107,11 @@ Google Closure library itself.
107107

108108
Once you've done this, you should be able to import your types with
109109
statements like:
110-
110+
```js
111111
goog.require('proto.my.package.MyMessage');
112112

113113
var message = proto.my.package.MyMessage();
114-
114+
```
115115
If unfamiliar with Closure or its compiler, consider reviewing
116116
[Closure documentation](https://developers.google.com/closure/library).
117117

@@ -134,11 +134,11 @@ to build it first by running:
134134

135135
Once you've done this, you should be able to import your types with
136136
statements like:
137-
137+
```js
138138
var messages = require('./messages_pb');
139139

140140
var message = new messages.MyMessage();
141-
141+
```
142142
The `--js_out` flag
143143
-------------------
144144

@@ -165,7 +165,7 @@ API
165165

166166
The API is not well-documented yet. Here is a quick example to give you an
167167
idea of how the library generally works:
168-
168+
```js
169169
var message = new MyMessage();
170170

171171
message.setName("John Doe");
@@ -176,6 +176,6 @@ idea of how the library generally works:
176176
var bytes = message.serializeBinary();
177177

178178
var message2 = MyMessage.deserializeBinary(bytes);
179-
179+
```
180180
For more examples, see the tests. You can also look at the generated code
181181
to see what methods are defined for your generated messages.

0 commit comments

Comments
 (0)
0