panvimdoc icon indicating copy to clipboard operation
panvimdoc copied to clipboard

bug: vimdoc should remove whitespace in front of indented code blocks

Open mikesmithgh opened this issue 8 months ago • 2 comments

I have an issue where code blocks are not displaying correctly in some of my nested lists. I am not sure if this is specific to lists or occurs in other scenarios. I have added the steps to reproduce below. The issue that happens is the start of the codeblock > does not have a blank line above it and it has whitespace in front of it causing issues with vim help syntax.

Thanks!

Run the command ./panvimdoc.sh --project-name test-code-block --input-file test-README.md

test-README.md
    # test code blocks
    
    ```lua
        print('code block at root')
        print('code block at root')
        print('code block at root')
    ```
    
    - list
    
        ```lua
            print('code block in list')
            print('code block in list')
            print('code block in list')
        ```
    
      - sublist
        - a
    
            ```lua
                print('a')
                print('a')
                print('a')
            ```
    
        - b
    
            ```lua
                print('b')
                print('b')
                print('b')
            ```

Actual output
*test-code-block.txt*            For             Last change: 2023 November 04

==============================================================================
Table of Contents                          *test-code-block-table-of-contents*

1. test code blocks                         |test-code-block-test-code-blocks|

==============================================================================
1. test code blocks                         *test-code-block-test-code-blocks*

>lua
        print('code block at root')
        print('code block at root')
        print('code block at root')
<

- list
    >lua
            print('code block in list')
            print('code block in list')
            print('code block in list')
    <
    - sublist
        - a
            >lua
                    print('a')
                    print('a')
                    print('a')
            <
        - b
            >lua
                    print('b')
                    print('b')
                    print('b')
            <

Generated by panvimdoc <https://github.com/kdheepak/panvimdoc>

vim:tw=78:ts=8:noet:ft=help:norl:

Expected output
*test-code-block.txt*            For             Last change: 2023 November 04

==============================================================================
Table of Contents                          *test-code-block-table-of-contents*

1. test code blocks                         |test-code-block-test-code-blocks|

==============================================================================
1. test code blocks                         *test-code-block-test-code-blocks*

>lua
        print('code block at root')
        print('code block at root')
        print('code block at root')
<

- list

>lua
            print('code block in list')
            print('code block in list')
            print('code block in list')
<
    - sublist
        - a

>lua
                    print('a')
                    print('a')
                    print('a')
<
        - b

>lua
                    print('b')
                    print('b')
                    print('b')
<

Generated by panvimdoc <https://github.com/kdheepak/panvimdoc>

vim:tw=78:ts=8:noet:ft=help:norl:

Screenshot (actual on left, expected on right)

expected_vs_actual

mikesmithgh avatar Nov 05 '23 00:11 mikesmithgh