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

docs: remove toc from first tool guide and add unique ids to markdown headers #580

Merged

Conversation

njhale
Copy link
Member

@njhale njhale commented Nov 13, 2024

  • The default table of contents is incompatible with tabs, so remove it
    from the first-tool guide
  • Auto-generated IDs for markdown headers in the first-tool page aren't
    unique, so generate unique IDs and inject them at snippet fetch time
  • Re-fetch latest README.md files from *-hash-tool repos to fix
    guide doc formatting issues


```text
> **Note:** `*` is a wild card pattern that applies the metadata to all Tools in a `tool.gpt`.
Copy link
Contributor

Choose a reason for hiding this comment

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

There is a "callout" for things like this.

Suggested change
> **Note:** `*` is a wild card pattern that applies the metadata to all Tools in a `tool.gpt`.
:::note
`*` is a wild card pattern that applies the metadata to all Tools in a `tool.gpt`.
:::

Copy link
Member Author

Choose a reason for hiding this comment

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

Is this valid markdown, or is it mdx? These files are automatically fetched at build time from the example repos; in this case https://github.com/otto8-ai/python-hash-tool/blob/main/README.md, so it's nice to stick to GitHub compatible markdown if we can.

![Search For Newly Added Tools](https://raw.githubusercontent.com/otto8-ai/python-hash-tool/refs/heads/main/docs/add-tools-step-3.png "Search For Newly Added Tools")

### Using The `Hash` Tool in an Agent
1. <details>
Copy link
Contributor

Choose a reason for hiding this comment

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

Curious why we need HTML instead of Markdown?

Copy link
Member Author

Choose a reason for hiding this comment

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

HTML gives us better control the size and position of the images in this document. In this case I'm also using <details> to keep them hidden until the user clicks on the step, greatly reducing visual clutter.

If there's a better way to do this without HTML, I'm all ears.

const FILE_URLS = [
'https://raw.githubusercontent.com/otto8-ai/python-hash-tool/main/README.md',
'https://raw.githubusercontent.com/njhale/python-hash-tool/main/README.md',
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this an expected change?

Copy link
Member Author

Choose a reason for hiding this comment

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

nope! this was leftover from testing, thank you for catching that.

@@ -62,6 +64,25 @@ async function fetchFiles(outputDir: string) {
);
}

// Function to add unique IDs to Markdown headers
function addUniqueHeaderIds(url, markdown: string): string {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this necessary? Can we just add the IDs directly?

Copy link
Member Author

Choose a reason for hiding this comment

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

This makes it easier for folks to fetch and use Markdown from any repo together without having to make changes to those repos to make the IDs unique.

Also, the syntax to add these IDs is mdx, so any IDs would render in GitHub's markdown preview:

Screenshot 2024-11-14 at 1 17 22 PM

@njhale njhale force-pushed the docs/remove-toc-from-first-tool-guide branch 3 times, most recently from fd65a71 to 2bdfb49 Compare November 14, 2024 23:59
@njhale njhale requested a review from thedadams November 15, 2024 00:03
headers

- The default table of contents is incompatible with tabs, so remove it
  from the first-tool guide
- Auto-generated IDs for markdown headers in the first-tool page aren't
  unique, so generate unique IDs and inject them at snippet fetch time
- Re-fetch latest README.md files from `*-hash-tool` repos to fix
  guide doc formatting issues

Signed-off-by: Nick Hale <[email protected]>
@njhale njhale force-pushed the docs/remove-toc-from-first-tool-guide branch from 2bdfb49 to c7b97db Compare November 20, 2024 18:18
@njhale njhale merged commit f1e12f1 into obot-platform:main Nov 20, 2024
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.

2 participants