Skip to content

Added code examples #205

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

Merged
merged 4 commits into from
Aug 14, 2024
Merged

Added code examples #205

merged 4 commits into from
Aug 14, 2024

Conversation

JBBianchi
Copy link
Member

Many thanks for submitting your Pull Request ❤️!

What this PR does / why we need it:
Added a tabbed panel for code samples.

Closes #203

Special notes for reviewers:
At the moment of opening this PR, it's still very rough. It's a demonstration of what could be done with little effort. The style could probably be improved, and content need to be decided.

Few technical notes:

  • 'blocks' sections ({{% /blocks/section %}}) can't be used, they create a bug with the tabpane making it unusable. I relied on the HTML counter part instead. Unfortunately, this implies that future updates of Docsy or its theme could result in a broken layout (due to class updates for instance).
  • Indentation inside the HTML block should not be respected. The MD should start straight with no indentation otherwise it's not processed.
    e.g.:
    Doesn't work (the MD of the code blocks is not processed):
<section class="row td-box td-box--5 td-box--height-auto">
  <div class="col">
    <div class="row">
      <div class="col">
        {{< tabpane text=true right=true >}}
          {{% tab header="**Examples**:" disabled=true /%}}
          {{% tab header="Minimal" lang="minimal" %}}
          ```yaml
          document:
            dsl: 1.0.0-alpha1
            namespace: examples
            name: call-http-shorthand-endpoint
            version: 1.0.0-alpha1
          do:
            - getPet:
                call: http
                with:
                  method: get
                  endpoint: https://petstore.swagger.io/v2/pet/{petId}
          ```
          {{% /tab %}}
          {{% tab header="Async API" lang="asyncapi" %}}
          ```yaml
          document:
            dsl: 1.0.0-alpha1
            namespace: examples
            name: bearer-auth
            version: 1.0.0-alpha1
          do:
            - findPet:
                call: asyncapi
                with:
                  document:
                    uri: https://fake.com/docs/asyncapi.json
                  operationRef: findPetsByStatus
                  server: staging
                  message: getPetByStatusQuery
                  binding: http
                  payload:
                    petId: ${ .pet.id }
                  authentication:
                    bearer:
                      token: ${ .token }
          ```
          {{% /tab %}}
        {{< /tabpane >}}
      </div>
    </div>
  </div>
</section>

Additional information (if needed):
Preview:
image

Signed-off-by: Jean-Baptiste Bianchi <jb.bianchi@neuroglia.io>
@JBBianchi JBBianchi changed the title [WIP ]Added code examples [WIP] Added code examples Jul 3, 2024
@ricardozanini
Copy link
Member

@JBBianchi to me this looks really good already. What do you need to move forward? Content?

Copy link
Member

@cdavernas cdavernas left a comment

Choose a reason for hiding this comment

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

LGTM! Cheers ❤️

@JBBianchi
Copy link
Member Author

@JBBianchi to me this looks really good already. What do you need to move forward? Content?

Content and probably improve the style a bit. It's a bit rough on the edges now.

Copy link
Member

@ricardozanini ricardozanini left a comment

Choose a reason for hiding this comment

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

Great! GH is telling me that there are conflicts so I can't merge it. Can u take a look @JBBianchi?

Signed-off-by: Jean-Baptiste Bianchi <jb.bianchi@neuroglia.io>
Signed-off-by: Jean-Baptiste Bianchi <jb.bianchi@neuroglia.io>
@JBBianchi JBBianchi changed the title [WIP] Added code examples Added code examples Aug 14, 2024
@cdavernas cdavernas merged commit ae0ad15 into serverlessworkflow:main Aug 14, 2024
5 checks passed
@cdavernas cdavernas deleted the feat-samples branch August 14, 2024 11:01
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.

Add a new "code" section/panel to the initial page so visitors can have a glimpse of the new DSL
3 participants