Skip to content

Keep table indentation level unchanged during formatting #64

@igordejanovic

Description

@igordejanovic

It would be nice to keep table indentation level unchanged during formatting. I'm using the extension in the context of a language which uses tables which are nested inside other code elements. Currently, Text Tables always reformat table at the first column.

Emacs orgmode keep indentation according to the first row. So the | of the table beginning is anchored and never moves. User can explicitly indent first line to affect indentation of the whole table.

Example:

        | first | second |
  |  blah blah | this is some text |

after reformatting becomes

        | first     | second            |
        | blah blah | this is some text |

I have investigated the code today and the first idea was to keep the indentation level startCol on the table model during parsing and then indent each line by that value during stringifying. Probably navigation commands should be updated to take indentation into account. For example, pressing Tab when in the indent region should jump into the first column of that row.
Are there any gotchas I'm not aware of?

BTW, thanks for the extension. It is really helpful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions