Skip to content

Commit

Permalink
Reproduce the bug in local.mdx
Browse files Browse the repository at this point in the history
  • Loading branch information
ptgott committed Nov 15, 2024
1 parent e0bad1d commit c058058
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 0 deletions.
44 changes: 44 additions & 0 deletions server/fixtures/hcl-addr-var.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
1. Create a `main.tf` file containing this minimal Terraform code:

```hcl
terraform {
required_providers {
teleport = {
source = "terraform.releases.teleport.dev/gravitational/teleport"
version = "~> (=teleport.major_version=).0"
}
}
}
provider "teleport" {
addr = '<Var name="teleport.example.com:443" />'
}
# We must create a test role, if we don't declare resources, Terraform won't try to
# connect to Teleport and we won't be able to validate the setup.
resource "teleport_role" "test" {
version = "v7"
metadata = {
name = "test"
description = "Dummy role to validate Terraform Provider setup"
labels = {
test = "yes"
}
}
spec = {}
}
```

1. Then, init your Terraform working directory to download the Teleport provider:

```code
$ terraform init
Initializing the backend...
Initializing provider plugins...
- Finding terraform.releases.teleport.dev/gravitational/teleport versions matching ...
```

1. Finally, run a Terraform plan:

Empty file.
18 changes: 18 additions & 0 deletions uvu-tests/rehype-hljs-var.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,4 +145,22 @@ Suite("Ignore VarList in code snippet components", () => {
});
});

Suite("TODO", () => {
const result = transformer({
value: readFileSync(resolve("server/fixtures/hcl-addr-var.mdx"), "utf-8"),
path: "/docs/index.mdx",
});

// Note that, because of rehypeMdxToHast, the <Var> components ending up
// having the <var> tag. The MDX configuration in the DocsPage layout maps
// this to Var.
assert.equal(
(result.value as string).trim(),
readFileSync(
resolve("server/fixtures/result/hcl-addr-var.html"),
"utf-8"
).trim()
);
});

Suite.run();

0 comments on commit c058058

Please sign in to comment.