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

feat: add text imports #79

Merged
merged 6 commits into from
Oct 12, 2023
Merged

feat: add text imports #79

merged 6 commits into from
Oct 12, 2023

Conversation

sarahschwartz
Copy link
Contributor

@sarahschwartz sarahschwartz commented Oct 11, 2023

adds the ability to import text between guides, cleans up the code import plugin, and pulls in installation instructions into the quickstart from the installation guide

@sarahschwartz sarahschwartz self-assigned this Oct 11, 2023
Copy link
Contributor

@calldelegation calldelegation left a comment

Choose a reason for hiding this comment

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

Just one comment looks good to me otherwise! Nice job on this

@cold-briu cold-briu closed this Oct 12, 2023
@cold-briu
Copy link
Contributor

Let Them Cook 🔥
This is amazing 👏 it can be a whole framework.

Semantic imports

LFG plugins for remak that can extract sections of other documents delimited by comment-names.

This comment-name is a semantic key that links multiple components to import, parse, render and test,

Code Imports

key: 'install_fuelup_command'

{/* install_fuelup_command:example:start */}
`` `sh
curl --proto '=https' --tlsv1.2 -sSf https://install.fuel.network/fuelup-init.sh | sh
`` `
{/* install_fuelup_command:example:end */}
<CodeImport
  file="../installation/index.mdx"
  comment="install_fuelup_command"
  commentType="{/*"
  lang="sh"
  trim="true"
/>

Text imports

key: install_fuelup

{/* install_fuelup:example:start */}
To install the Fuel toolchain, you'll use the `fuelup-init` script. This will install `forc`, `forc-client`, `forc-fmt`, `forc-lsp`, `forc-wallet` as well as `fuel-core` in `~/.fuelup/bin`.
{/* install_fuelup:example:end */}
<TextImport
  file="../installation/index.mdx"
  comment="install_fuelup"
  commentType="{/*"
/>

Test actions

key: ?

<TestAction
    id="create-project-folder"
    action={{ 
    name: 'runCommand', 
    commandFolder: 'guides-testing'
    }}
/>

Some ideas

Snippet import

A pattern emerges: the code snippet component might be not only a render component but a whole syntax.

<CodeSnippet
    id="install_fuelup"
    file="../installation/snippets.mdx"
/>

That gets resolved to:

../installation/snippets.mdx

{/* install_fuelup:snippet:start */}

{/* install_fuelup:snippet:explanation:start */}

To install the Fuel toolchain, you'll use the `fuelup-init` script. This will install `forc`, `forc-client`, `forc-fmt`, `forc-lsp`, `forc-wallet` as well as `fuel-core` in `~/.fuelup/bin`.

{/* install_fuelup:snippet:explanation:end */}


{/* install_fuelup:testAction:start */}

<TestAction
    id="create-project-folder"
    action={{ 
    name: 'runCommand', 
    commandFolder: 'guides-testing'
    }}
/>

{/* install_fuelup:testAction:end */}


{/* install_fuelup:command|code:example:start */}

`` `sh
curl --proto '=https' --tlsv1.2 -sSf https://install.fuel.network/fuelup-init.sh | sh
`` `

{/* install_fuelup:command|code:example:end */}

{/* install_fuelup:commandOutput|code:example:start */}

`` `sh
foo barr
`` `

{/* install_fuelup:commandOutput|code:example:end */}


{/* install_fuelup:snippet:end */}

Then, the installation guide might look like:

## installing rust

The Fuel toolchain is built on top of the Rust programming language.

<CodeSnippet
    id="install_rust"
    file="../installation/snippets.mdx"
/>

Check the official Rust documentation to get more information on [installing the Rust toolchain](https://www.rust-lang.org/tools/install).

## Installing the Fuel toolchain using fuelup

`fuelup` is the official package manager for Fuel that installs the Fuel toolchain
from the official release channels, enabling you to easily switch between different
toolchains and keep them updated. It makes building and maintaining Sway applications simpler with [`forc`](docs/forc) and [`fuel-core`](https://github.com/FuelLabs/fuel-core) for common platforms.

> 💡 Check out the [fuelup docs](docs/fuelup) for more information.

<CodeSnippet
    id="install_fuelup"
    file="../installation/snippets.mdx"
/>

Can be applied in the installation section of the quickstart as well.


It feels to me like a natural step towards something similar to the GraphQl Recipe component.

🥳🥳🥳

It's very exciting to see how this whole docs effort evolves.
Congratulations!

Copy link
Contributor

@cold-briu cold-briu left a comment

Choose a reason for hiding this comment

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

Great job here!
This is amazing.
I think the docs-hub is getting to a stage where it needs to be documented.

👽 Documenting the documentation.

@cold-briu cold-briu reopened this Oct 12, 2023
@sarahschwartz
Copy link
Contributor Author

sarahschwartz commented Oct 12, 2023

Great job here! This is amazing. I think the docs-hub is getting to a stage where it needs to be documented.

👽 Documenting the documentation.

Thanks, I agree, we should add this to the README. The TestAction actions are documented in the tests/utils/types.ts file btw.

Also, I like your idea about combining snippets, I'll add that to the backlog as well.

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.

3 participants