Qownnotes: Auto format table

Created on 30 Oct 2018  路  14Comments  路  Source: pbek/QOwnNotes

Currently the text editor in QOwnNotes understands and marks the tables as code. This is an enhancement request to also auto format the table when user inputs a separator |.

Example:

  1. Assume given text as below
| header 1 | header 2 |
| content abc 
  1. User inputs | after abc
  2. Expected output - note how the | after header 1 auto indented itself
| header 1    | header 2 |
| content abc |

This makes the content more readable.

Copied from issue at https://github.com/pbek/qmarkdowntextedit/issues/13

Feature

All 14 comments

Thank you for your suggestion.

I'm still not sure if that should be done automatically, because it would eat a lot of resources to test if a table is present on every keystroke...

18.11.0

  • you can now auto format spaces in a markdown table at the current cursor
    position with Edit / Edit / Auto format table

    • the auto complete shortcut Ctrl + Space also will

      attempt to auto format the table

There now is a new release, could you please test it and report if it works for you?

It works great!

One minor issue: the formatting goes to new line if one of the rows is longer. While I'd expect the rows are expanded to the longest one, observation is smaller rows just end up at left margin.

Example

| KOS Type | Inclusions |
| -- | -- |
| Thesaurus | Collection of Items in a selected Domain; can specify Attributes and Relations (Equivalence, Hierarchical, Associative, Contrast) |

Use auto format. Output (text below, also highlighted the misalignment in image):

| KOS Type  | Inclusions                                                                                                                        |
| --        | --                                                                                                                                |
| Thesaurus | Collection of Items in a selected Domain; can specify Attributes and Relations (Equivalence, Hierarchical, Associative, Contrast) |

image

I guess you are misled by the soft-wrap feature in the Window menu, please try to turn it off, then the table row really should stay in one line.

thanks, turning off soft-wrap, everything works as expected.

Great, thank you for testing!

Whoohah! this is an amazing improvement, cheers!!

I'm happy you like it @sanderboom ;)

18.11.1

  • the auto formatter of markdown tables will now also automatically
    increase the size of the headline separator

This was exactly my next question :yum: Nice man!

There now is a new release, could you please test it and report if it works for you?

tested the latest bits, auto expansion of headline separator is working great!

Awesome! :)

Was this page helpful?
0 / 5 - 0 ratings