Skip to content

Commit

Permalink
more iterations
Browse files Browse the repository at this point in the history
  • Loading branch information
nermalcat69 committed Nov 29, 2024
1 parent a032cb6 commit 61fb0a6
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 67 deletions.
125 changes: 63 additions & 62 deletions apps/docs/content/references/importyml/pre-processor.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ The second turn handles standard processing, where the system creates the import
<table className="w-full rounded-lg my-1.5 text-center">
<thead>
<tr className="text-center">
<th className="w-fit"><strong>Sequence</strong></th>
<th className="w-fit"><strong>Description</strong></th>
<th className="w-fit">Sequence</th>
<th className="w-fit">Description</th>
</tr>
</thead>
<tbody className="text-center">
Expand Down Expand Up @@ -160,8 +160,9 @@ services:
### Escaping to print out reserved characters

Reserved characters `\<>|` have to be escaped using the `\` backslash to print them out. It's mandatory to escape the `\` character itself.

⚠️ There is one caveat with our pre-processing step of the YAML import script because we are parsing the script twice. The first time when evaluating import function expressions, string expressions, and applied modificators, and the second time, when parsing the final YAML composed structure. In each phase, one escaping level of the backslash is done, meaning that each removes one `\`. That's why the `\` character has to be escaped twice (`\\\\` instead of `\\`) to print out `\` on the output finally.
:::caution
There is one caveat with our pre-processing step of the YAML import script because we are parsing the script twice. The first time when evaluating import function expressions, string expressions, and applied modificators, and the second time, when parsing the final YAML composed structure. In each phase, one escaping level of the backslash is done, meaning that each removes one `\`. That's why the `\` character has to be escaped twice (`\\\\` instead of `\\`) to print out `\` on the output finally.
:::

It means that if `ESCAPED_VALUE: <\\\\>` is used, the final value stored in the environment variable will be just `\`. The same is true for any value with backslashes, like `ESCAPED_VALUE: True\\\\False`, where the stored result will be `True\False`.

Expand Down Expand Up @@ -234,8 +235,8 @@ APP_PUBLIC_KEY_SSH: <@getVar(KeyPublicSsh)>
<table className="w-full rounded-lg my-1.5 text-center">
<thead>
<tr>
<th className="w-fit"><strong>Field</strong></th>
<th className="w-fit"><strong>Details</strong></th>
<th className="w-fit">Field</th>
<th className="w-fit">Details</th>
</tr>
</thead>
<tbody>
Expand Down Expand Up @@ -268,8 +269,8 @@ APP_PUBLIC_KEY_SSH: <@getVar(KeyPublicSsh)>
<table className="w-full rounded-lg my-1.5 text-center">
<thead>
<tr>
<th className="w-fit"><strong>Field</strong></th>
<th className="w-fit"><strong>Details</strong></th>
<th className="w-fit">Field</th>
<th className="w-fit">Details</th>
</tr>
</thead>
<tbody>
Expand Down Expand Up @@ -305,8 +306,8 @@ APP_PUBLIC_KEY_SSH: <@getVar(KeyPublicSsh)>
<table className="w-full rounded-lg my-1.5 text-center">
<thead>
<tr>
<th className="w-fit"><strong>Field</strong></th>
<th className="w-full"><strong>Details</strong></th>
<th className="w-fit">Field</th>
<th className="w-full">Details</th>
</tr>
</thead>
<tbody>
Expand Down Expand Up @@ -338,8 +339,8 @@ APP_PUBLIC_KEY_SSH: <@getVar(KeyPublicSsh)>
<table className="w-full rounded-lg my-1.5 text-center">
<thead>
<tr>
<th className="w-fit"><strong>Field</strong></th>
<th className="w-fit"><strong>Details</strong></th>
<th className="w-fit">Field</th>
<th className="w-fit">Details</th>
</tr>
</thead>
<tbody>
Expand Down Expand Up @@ -375,8 +376,8 @@ APP_PUBLIC_KEY_SSH: <@getVar(KeyPublicSsh)>
<table className="w-full rounded-lg my-1.5 text-center">
<thead>
<tr>
<th className="w-fit"><strong>Field</strong></th>
<th className="w-fit"><strong>Details</strong></th>
<th className="w-fit">Field</th>
<th className="w-fit">Details</th>
</tr>
</thead>
<tbody>
Expand Down Expand Up @@ -409,8 +410,8 @@ APP_PUBLIC_KEY_SSH: <@getVar(KeyPublicSsh)>
<table className="w-full rounded-lg my-1.5 text-center">
<thead>
<tr>
<th className="w-fit"><strong>Field</strong></th>
<th className="w-fit"><strong>Details</strong></th>
<th className="w-fit">Field</th>
<th className="w-fit">Details</th>
</tr>
</thead>
<tbody>
Expand Down Expand Up @@ -449,8 +450,8 @@ APP_PUBLIC_KEY_SSH: <@getVar(KeyPublicSsh)>
<table className="w-full rounded-lg my-1.5 text-center">
<thead>
<tr>
<th className="w-fit"><strong>Field</strong></th>
<th className="w-fit"><strong>Details</strong></th>
<th className="w-fit">Field</th>
<th className="w-fit">Details</th>
</tr>
</thead>
<tbody>
Expand Down Expand Up @@ -500,9 +501,9 @@ APP_PUBLIC_KEY_SSH: <@getVar(KeyPublicSsh)>
<table className="w-full rounded-lg my-1.5 text-center">
<thead>
<tr>
<th className="w-fit"><strong>Type</strong></th>
<th className="w-fit"><strong>Mask</strong></th>
<th className="w-full"><strong>Output</strong></th>
<th className="w-fit">Type</th>
<th className="w-fit">Mask</th>
<th className="w-full">Output</th>
</tr>
</thead>
<tbody>
Expand Down Expand Up @@ -634,8 +635,8 @@ APP_PUBLIC_KEY_SSH: <@getVar(KeyPublicSsh)>
<table className="w-full rounded-lg my-1.5 text-center">
<thead>
<tr>
<th className="w-fit"><strong>Field</strong></th>
<th className="w-fit"><strong>Details</strong></th>
<th className="w-fit">Field</th>
<th className="w-fit">Details</th>
</tr>
</thead>
<tbody>
Expand Down Expand Up @@ -795,8 +796,8 @@ services:
<table className="w-full rounded-lg my-1.5 text-center">
<thead>
<tr>
<th className="w-fit"><strong>Field</strong></th>
<th className="w-fit"><strong>Details</strong></th>
<th className="w-fit">Field</th>
<th className="w-fit">Details</th>
</tr>
</thead>
<tbody>
Expand Down Expand Up @@ -979,8 +980,8 @@ services:
<table className="w-full rounded-lg my-1.5 text-center">
<thead>
<tr>
<th className="w-fit"><strong>Field</strong></th>
<th className="w-fit"><strong>Details</strong></th>
<th className="w-fit">Field</th>
<th className="w-fit">Details</th>
</tr>
</thead>
<tbody>
Expand Down Expand Up @@ -1187,8 +1188,8 @@ The elegance of using modifiers lies in their simplified syntax for transforming
<table className="w-full rounded-lg my-1.5 text-center">
<thead>
<tr>
<th className="w-fit"><strong>Name</strong></th>
<th className="w-fit"><strong>Description</strong></th>
<th className="w-fit">Name</th>
<th className="w-fit">Description</th>
</tr>
</thead>
<tbody>
Expand Down Expand Up @@ -1232,49 +1233,49 @@ The elegance of using modifiers lies in their simplified syntax for transforming

### Examples of correct using of import modifiers

#### Generating a plain password and related hashes

<Dropdown>
<DropdownItem question="Generating a plain password and related hashes">

<table className="w-full rounded-lg my-1.5 text-center">
<thead>
<tr>
<th className="w-fit"><strong>Input</strong></th>
<th className="w-fit"><strong>Output</strong></th>
</tr>
</thead>
<tbody>
<tr>
<td className="w-fit">`<@generateRandomStringVar(<myPassword>, <30>)>`</td>
<td className="w-fit">7a14c8e74bc98a0d74253b1d1a4ef6</td>
</tr>
<tr>
<td className="w-fit">`<@getVar(myPassword)| sha256>`</td>
<td className="w-fit">081b91d6dff5036229a92e2442fb65d7c8124571d4e70a2ac4729aeb86957407</td>
</tr>
<tr>
<td className="w-fit">`<@getVar(myPassword)| sha512>`</td>
<td className="w-fit">89c05547de0aa4926512a958f95ab8bf4096ceec63ad5aad4266890bfa059e0cc98917c54276ba4cd61f1dde4c8efda948fc967885c9dd50558ed939722ca10c</td>
</tr>
<tr>
<td className="w-fit">`<@getVar(myPassword)| bcrypt>`</td>
<td className="w-fit">$2a$10$CxKZX0yIxdc7ts6eI5aBu.g.heAsFcePdMDEpnlViTlo3vGc//PXe</td>
</tr>
<tr>
<td className="w-fit">`<@getVar(myPassword)| argon2id>`</td>
<td className="w-fit">$argon2id$v=19$m=98304,t=1,p=3$uWBpmoUT3sfckXHyRF9hlg$8bGtNffuHxaRIgN99zCmJeGEYJF5BY2J9TwzqmezP28</td>
</tr>
</tbody>
</table>
- `<@generateRandomStringVar(<myPassword>, <30>)>` will output a random string of 30 characters:
```yaml
7a14c8e74bc98a0d74253b1d1a4ef6
```

- `<@getVar(<myPassword>)| sha256>` will output the sha256 hash of the `<myPassword>` variable:
```yaml
081b91d6dff5036229a92e2442fb65d7c8124571d4e70a2ac4729aeb86957407
```

- `<@getVar(<myPassword>)| sha512>` will output the sha512 hash of the `<myPassword>` variable:
```yaml
89c05547de0aa4926512a958f95ab8bf4096ceec63ad5aad4266890bfa059e0cc98917c54276ba4cd61f1dde4c8efda948fc967885c9dd50558ed939722ca10c
```

- `<@getVar(<myPassword>)| bcrypt>` will output the bcrypt hash of the `<myPassword>` variable:
```yaml
$2a$10$CxKZX0yIxdc7ts6eI5aBu.g.heAsFcePdMDEpnlViTlo3vGc//PXe
```

- `<@getVar(<myPassword>)| argon2id>` will output the argon2id hash of the `<myPassword>` variable:
```yaml
$argon2id$v=19$m=98304,t=1,p=3$uWBpmoUT3sfckXHyRF9hlg$8bGtNffuHxaRIgN99zCmJeGEYJF5BY2J9TwzqmezP28
```
</DropdownItem>
<DropdownItem question="APP_PUBLIC_KEY">
- Generated as a multiline value.
- The same value as in GENERATED_PUBLIC_KEY.
</DropdownItem>
</Dropdown>

#### Converting a string to upper-case, lover-case, and title-case variants


<table className="w-full rounded-lg my-1.5 text-center">
<thead>
<tr>
<th className="w-fit"><strong>Input</strong></th>
<th className="w-fit"><strong>Output</strong></th>
<th className="w-fit">Input</th>
<th className="w-fit">Output</th>
</tr>
</thead>
<tbody>
Expand Down
8 changes: 4 additions & 4 deletions apps/docs/src/components/Dropdown/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ChevronDownMini, ChevronUpMini } from '@medusajs/icons';
import React, { ReactNode, useState, useRef, useEffect } from 'react';

interface DropdownItemProps {
question: string;
question: ReactNode;
children: ReactNode;
}

Expand All @@ -23,11 +23,11 @@ export function DropdownItem({ question, children }: DropdownItemProps) {
<div className="py-0.5">
<div className="card bg-[#F2F5F7] dark:bg-medusa-bg-base shadow-card-rest dark:shadow-card-rest-dark w-full p-[5px] rounded-md">
<button
className="flex w-full p-[10px] justify-between items-center text-left bg-transparent border-none cursor-pointer"
className="flex w-full p-[9px] justify-between items-center text-left bg-transparent border-none cursor-pointer"
onClick={() => setIsOpen(!isOpen)}
aria-expanded={isOpen}
>
<span className="text-[13px] ml-0.5 font-medium cursor-pointer">{question}</span>
<span className="text-[14px] font-medium cursor-pointer">{question}</span>
{isOpen ? (
<ChevronUpMini className="text-gray-400" />
) : (
Expand All @@ -40,7 +40,7 @@ export function DropdownItem({ question, children }: DropdownItemProps) {
style={{ height: height }}
role="region"
>
<p className="px-0.75 mt-1 -mb-1">{children}</p>
<p className="px-0.75 m-[11px] mt-1 -mb-1">{children}</p>
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/src/theme/CodeBlock/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export default function CodeBlock({
};

return (
<div className="code-wrapper selection:bg-primary-500 selection:text-green-500">
<div className="code-wrapper selection:bg-sky-950 selection:text-green-400">
{(title || badge.label) && (
<div className="code-header">
{title}
Expand Down

0 comments on commit 61fb0a6

Please sign in to comment.