asciidoctor / kramdown-asciidoc

A kramdown extension for converting Markdown documents to AsciiDoc.
Other
207 stars 19 forks source link

YAML code blocks do not convert correctly #108

Closed apinnick closed 1 year ago

apinnick commented 1 year ago

If a YAML code block has 2 or more lines of text before it, the YAML indentation is mangled. The only workaround I have found is to leave a blank line above the code block. However, this means that I have to manually edit the Asciidoc file to add "+" before the YAML block.

YAML code block without blank line:

3. Check each outdated VMI to determine whether it is live-migratable:
```bash
$ kubectl get vmi <vmi> -o yaml
```
Example output:
```yaml
apiVersion: kubevirt.io/v1
kind: VirtualMachineInstance
...
  status:
    conditions:
    - lastProbeTime: null
      lastTransitionTime: null
      message: cannot migrate VMI which does not use masquerade to connect to the pod network
      reason: InterfaceNotLiveMigratable
      status: "False"
      type: LiveMigratable
```

Result:

. Check each outdated VMI to determine whether it is live-migratable:
+
[,bash]
----
$ kubectl get vmi <vmi> -o yaml
----
+
Example output:
```yaml
apiVersion: kubevirt.io/v1
kind: VirtualMachineInstance
...
  status:
 conditions:

 ** lastProbeTime: null
lastTransitionTime: null
message: cannot migrate VMI which does not use masquerade to connect to the pod network
reason: InterfaceNotLiveMigratable
status: "False"
type: LiveMigratable
```

YAML code block with blank line:

3. Check each outdated VMI to determine whether it is live-migratable:
```bash
$ kubectl get vmi <vmi> -o yaml
```
Example output:

```yaml
apiVersion: kubevirt.io/v1
kind: VirtualMachineInstance
...
  status:
    conditions:
    - lastProbeTime: null
      lastTransitionTime: null
      message: cannot migrate VMI which does not use masquerade to connect to the pod network
      reason: InterfaceNotLiveMigratable
      status: "False"
      type: LiveMigratable
```

Result:

. Check each outdated VMI to determine whether it is live-migratable:
+
[,bash]
----
$ kubectl get vmi <vmi> -o yaml
----
+
Example output:

[,yaml]
----
apiVersion: kubevirt.io/v1
kind: VirtualMachineInstance
...
  status:
    conditions:
    - lastProbeTime: null
      lastTransitionTime: null
      message: cannot migrate VMI which does not use masquerade to connect to the pod network
      reason: InterfaceNotLiveMigratable
      status: "False"
      type: LiveMigratable
----
mojavelinux commented 1 year ago

Please provide a PR with a failing test / scenario and I will look into fixing it.

apinnick commented 1 year ago

https://github.com/asciidoctor/kramdown-asciidoc/pull/109

mojavelinux commented 1 year ago

This is not a problem with kramdoc. Kramdown does not see this as valid Markdown. The problem is the lack of space between the blocks and the lack of indentation in this list. This would be the proper Markdown syntax:

This is an example of a procedure with a yaml code block that does not convert correctly.

1. blah blah
2. Check each outdated VMI to determine whether it is live-migratable:

   ```bash
   $ kubectl get vmi <vmi> -o yaml
   ```

   Example output:

   ```yaml
   apiVersion: kubevirt.io/v1
   kind: VirtualMachineInstance
   ...
     status:
       conditions:
       - lastProbeTime: null
         lastTransitionTime: null
         message: cannot migrate VMI which does not use masquerade to connect to the pod network
         reason: InterfaceNotLiveMigratable
         status: "False"
         type: LiveMigratable
   ```

This library is named kramdown-asciidoc for a reason. It relies on kramdown to parse the Markdown. We can only use what kramdown gives us. If it doesn't parse something correctly, then the problem is with kramdown. If you believe the Markdown you are using is, in fact, correct, you can make your case with the kramdown project.

mojavelinux commented 1 year ago

After investigation, it was determined the the input Markdown is not valid (at least not according to kramdown).

apinnick commented 1 year ago

This is not a problem with kramdoc. Kramdown does not see this as valid Markdown.

Thank-you!!! I will fix my files