File tree 2 files changed +42
-0
lines changed
2 files changed +42
-0
lines changed Original file line number Diff line number Diff line change @@ -264,12 +264,53 @@ To include code from a file using a direct URL use `!from` operand inside a code
264
264
265
265
Example:
266
266
267
+ #### By line number
268
+
269
+ ```` markdown
270
+ ```cadence DepositFees.cdc
271
+ !from https://github.com/onflow/flow-core-contracts/blob/master/transactions/FlowServiceAccount/deposit_fees.cdc#L23
272
+ ```
273
+ ````
274
+
275
+ #### By line range
276
+
267
277
```` markdown
268
278
```cadence DepositFees.cdc
269
279
!from https://github.com/onflow/flow-core-contracts/blob/master/transactions/FlowServiceAccount/deposit_fees.cdc#L23-L26
270
280
```
271
281
````
272
282
283
+ #### By snippet name / Region Tag
284
+
285
+ Specific blocks of code that are embedded in documentation are defined using ` [START <snippet_name>] ` and ` [END <snippet_name>] ` region tags.
286
+
287
+ ``` ruby
288
+ def create_bucket project_id: , bucket_name:
289
+ # [START create_bucket]
290
+ # project_id = "Your Google Cloud project ID"
291
+ # bucket_name = "Your Google Cloud Storage bucket name"
292
+
293
+ require " google/cloud/storage"
294
+
295
+ storage = Google ::Cloud ::Storage .new project: project_id
296
+
297
+ bucket = storage.create_bucket bucket_name
298
+
299
+ puts " Created bucket #{ bucket.name } "
300
+ # [END create_bucket]
301
+ end
302
+ ```
303
+
304
+ and the reference would look like
305
+
306
+ ```` markdown
307
+ ```ruby
308
+ !from https://github.com/emosei/ruby-docs-samples/blob/master/storage/buckets.rb#create_bucket
309
+ ```
310
+ ````
311
+
312
+
313
+
273
314
This method keeps your documentation synchronized with your codebase by pulling the latest code directly into your docs.
274
315
275
316
Original file line number Diff line number Diff line change @@ -118,6 +118,7 @@ const plugin = () => {
118
118
}
119
119
120
120
const lines = getLines ( url ) ;
121
+ const snippetName = getSnippetName ( url ) ;
121
122
122
123
const fetchPromise = fetch ( url )
123
124
. then ( async ( res ) => {
You can’t perform that action at this time.
0 commit comments