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

Copy to clipboard on docs #403

Merged
merged 2 commits into from
Sep 21, 2022
Merged

Conversation

andresSaldanaAguilar
Copy link
Contributor

@andresSaldanaAguilar andresSaldanaAguilar commented Sep 21, 2022

What this PR does?

Adds the ability to copy the code block content.

NOTE: I applied the changes only in two fileds in order to demonstrate and review the functionality and code, I would substitute all fields in a separate PR once this PR is accepted.

  • Substituted markdown code block with a custom HTML element.
  • Added CSS aesthetics and responsiveness.
  • Added JS logic to copy text.
  • Added code-pretiffy script for syntax highlighting.

Examples

before:
image
after:
image
output copy result:

kubectl apply -f https://raw.githubusercontent.com/PlayFab/thundernetes/main/samples/gameserverapi/gameserverapi.yaml

before:
image
after:
image
output copy result:

apiVersion: mps.playfab.com/v1alpha1
kind: GameServerBuild
metadata:
  name: gameserverbuild-sample-netcore
spec:
  titleID: "1E03" # required
  buildID: "85ffe8da-c82f-4035-86c5-9d2b5f42d6f6" # must be a GUID
  standingBy: 2 # required
  max: 4 # required
  portsToExpose:
    - 80 # one of the ports mentioned below
  template:
    metadata:
        annotations:
          annotation1: annotationvalue1
        labels:
          label1: labelvalue1
    spec:
      containers:
        - image: ghcr.io/playfab/thundernetes-netcore:0.2.0
          name: thundernetes-sample-netcore
          ports:
          - containerPort: 80 # your game server port
            protocol: TCP # your game server port protocol
            name: gameport # required field    
  

@andresSaldanaAguilar andresSaldanaAguilar marked this pull request as ready for review September 21, 2022 14:54
Copy link
Collaborator

@khaines khaines left a comment

Choose a reason for hiding this comment

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

Thanks for adding this. It's always nice when an example has a quick copy button!

Also, thank you for trying this out on just a few buttons to prove out the change first. It makes reviewing much more effective.

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