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

Remote Substreams docs #346

Merged
merged 6 commits into from
May 2, 2023
Merged

Remote Substreams docs #346

merged 6 commits into from
May 2, 2023

Conversation

dimaMachina
Copy link
Contributor

@dimaMachina dimaMachina commented Apr 24, 2023

⚠️ Sometimes we can get API rate limit from https://api.github.com/repos/streamingfast/substreams/git/trees/develop?recursive=1 (URL for getting all available docs files).

Let's test it for now as is and in the future we can fetch this data only once while building our app

error - Error: {
 "message": "API rate limit exceeded for 37.65.12.11. (But here's the good news: Authenticated requests get a higher rate > limit. Check out the documentation for more details.)",
 "documentation_url": "https://docs.github.com/rest/overview/resources-in-the-rest-api#rate-limiting"
}

Comment on lines +22 to +44
const rawMdx = `---
title: ${t('index.title')}
---

${t('index.intro')}

<Intro />

## ${t('index.networkRoles.title')}

${t('index.networkRoles.description')}

<NetworkRoles />

## ${t('index.products.title')}

<Products />

## ${t('index.supportedNetworks.title')}

${t('index.supportedNetworks.description')}

<SupportedNetworks />`
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks pretty, + we avoid ugly code to inject frontmatter and headings for TOC

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is great!

)
return pageMap
}, [__nextra_internal__.pageMap, hasMDXPage, locale])
const localeSwitcher = <LocaleSwitcher key="localeSwitcher" />
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can avoid useMemo and just render component outside function declaration

@github-actions

This comment was marked as duplicate.

@dimaMachina dimaMachina marked this pull request as ready for review April 24, 2023 19:30
@dimaMachina dimaMachina requested a review from a team as a code owner April 24, 2023 19:30
@graphprotocol graphprotocol deleted a comment from github-actions bot Apr 24, 2023
"react": "^18.2.0",
"react-dom": "^18.2.0",
"sharp": "^0.32.0",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

@github-actions

This comment was marked as resolved.

Comment on lines +19 to +27
const banner = `
import { getPageMap } from '@/components/get-page-map'

export const getStaticProps = async context => ({
props: {
__nextra_pageMap: await getPageMap('${route.split('/')[1]}')
}
})`
result += banner
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does banner mean here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the piece of code to include getStaticProps for pages that don't have it

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, this is cool!

Comment on lines +30 to +40
() => (tree, _file, done) => {
const GITBOOK_CALLOUT_REGEX = /{%.*?%}/
visit(tree, 'paragraph', (node) => {
for (const child of node.children) {
if (child.value) {
child.value = child.value.replace(GITBOOK_CALLOUT_REGEX, '')
}
}
})
done()
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are these "callouts" that you're removing?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

something like this https://docs.gitbook.com/content-creation/blocks/hint#git-sync-representation-in-markdown

Note: I remove only callout tags not the callout itself

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it, thank you.

Copy link
Contributor

@benface benface left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work!

Looks like the substreams docs are only available in English at the moment, and they cannot be translated through Crowdin because they are not in this repo. Do we have any plans for that?

@dimaMachina
Copy link
Contributor Author

Looks like the substreams docs are only available in English at the moment, and they cannot be translated through Crowdin because they are not in this repo. Do we have any plans for that?

either setup another source for crowdin

Input:
https://github.com/streamingfast/substreams/tree/develop/docs

Output:
https://github.com/graphprotocol/docs/tree/main/website/pages

or just download raw .md files to https://github.com/graphprotocol/docs/blob/main/website/pages/en/substreams folder

But if we do it we don't need even Remote MDX since all Substreams docs will be restored inside this repo

@benface
Copy link
Contributor

benface commented Apr 28, 2023

@B2o5T – Something else that I noticed: the substreams pages don't set the current page's title in the <title>. It's always just The Graph Docs, as opposed to e.g. Running Substreams - The Graph Docs.

* Hide locale switcher on `/en/substreams` pages

* Trailing slashes are important, apparently
@saihaj saihaj merged commit a52086f into main May 2, 2023
@saihaj saihaj deleted the substreams branch May 2, 2023 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants