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

Add filenames to code examples #2667

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
7 changes: 6 additions & 1 deletion _includes/code/quickstart/connect.withkey.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import GoConnectCode from '!!raw-loader!/_includes/code/quickstart/go-connect.go
startMarker="# InstantiationExample"
endMarker="# END InstantiationExample"
language="py"
title="quickstart.py"
/>

</TabItem>
Expand All @@ -26,6 +27,7 @@ import GoConnectCode from '!!raw-loader!/_includes/code/quickstart/go-connect.go
startMarker="# InstantiationExample"
endMarker="# END InstantiationExample"
language="py"
title="quickstart.py"
/>

</TabItem>
Expand All @@ -36,6 +38,7 @@ import GoConnectCode from '!!raw-loader!/_includes/code/quickstart/go-connect.go
startMarker="// InstantiationExample"
endMarker="// END InstantiationExample"
language="ts"
title="quickstart.ts"
/>

</TabItem>
Expand All @@ -47,6 +50,7 @@ import GoConnectCode from '!!raw-loader!/_includes/code/quickstart/go-connect.go
startMarker="// InstantiationExample"
endMarker="// END InstantiationExample"
language="ts"
title="quickstart.ts"
/>

</TabItem>
Expand All @@ -57,6 +61,7 @@ import GoConnectCode from '!!raw-loader!/_includes/code/quickstart/go-connect.go
startMarker="// START InstantiationExample"
endMarker="// END InstantiationExample"
language="java"
title="quickstart.go"
/>
</TabItem>
{/* <TabItem value="java" label="Java">
Expand Down Expand Up @@ -101,7 +106,7 @@ public class App {
- With `curl`, add the API key to the header as shown below:
<br/>

```bash
```bash title="quickstart.sh"
echo '{
"query": "<QUERY>"
}' | curl \
Expand Down
4 changes: 2 additions & 2 deletions src/components/Documentation/FilteredTextBlock.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import CodeBlock from '@theme/CodeBlock';

const FilteredTextBlock = ({ text, startMarker, endMarker, language, includeStartMarker='false' }) => {
const FilteredTextBlock = ({ text, startMarker, endMarker, language, includeStartMarker='false', title=''}) => {
// Filter out lines that are before the start marker, and lines with or after the end marker
includeStartMarker = includeStartMarker == 'true';
const lines = text.split('\n');
Expand Down Expand Up @@ -52,7 +52,7 @@ const FilteredTextBlock = ({ text, startMarker, endMarker, language, includeStar


return (
<CodeBlock className={`language-${language2}`}>
<CodeBlock className={`language-${language2}`} title={title}>
{filteredLines}
</CodeBlock>
);
Expand Down