Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
33 changes: 33 additions & 0 deletions docs/contributing/style-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,39 @@ _sourceCategory=reinvent/travel/checkout

For a full list of options, see [Docusaurus Code Blocks](https://docusaurus.io/docs/markdown-features/code-blocks).

### Import GitHub repo file

To embed a code sample from a file in a GitHub repository, use `reference` in the code block with a link to the file. The code sample is embedded using the language with a link to the original file.

This code references a json script file:

<Tabs
className="unique-tabs"
defaultValue="Markdown"
values={[
{label: 'Markdown', value: 'Markdown'},
{label: 'Result', value: 'Result'},
]}>

<TabItem value="Markdown">

<img src={useBaseUrl('img/contributing/json-ref-codeblock.png')} alt="JSON code snippet from GitHub" style={{border: '1px solid gray'}} width="700"/>

</TabItem>
<TabItem value="Result">

```json reference
https://github.com/SumoLogic/sumologic-documentation/blob/main/static/files/c2c/1password/example.json
```

</TabItem>
</Tabs>

Optionally, you can:
* Reference a specific range of code lines by appending `#L` with the line number or numbers at the end of the URL. For example, `https://github.com/SumoLogic/sumologic-documentation/blob/main/static/files/c2c/1password/example.json#L4-L5`.
* Add a title to the code block, such as `json reference title="Hello"`.

You'll see this used in our [C2C source docs](/docs/send-data/hosted-collectors/cloud-to-cloud-integration-framework).

## Collapsible text blocks

Expand Down
1 change: 1 addition & 0 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ module.exports = {
],
plugins: [
'docusaurus-plugin-sass',
//Embed code file from GitHub repo
'@saucelabs/theme-github-codeblock',
['@docusaurus/plugin-google-tag-manager',
{
Expand Down
Binary file added static/img/contributing/json-ref-codeblock.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.