Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto format table #1052

Closed
codito opened this issue Oct 30, 2018 · 14 comments
Closed

Auto format table #1052

codito opened this issue Oct 30, 2018 · 14 comments
Milestone

Comments

@codito
Copy link

@codito codito commented Oct 30, 2018

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 pbek/qmarkdowntextedit#13

@pbek
Copy link
Owner

@pbek pbek commented Oct 30, 2018

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...

Loading

pbek added a commit that referenced this issue Nov 1, 2018
@pbek
Copy link
Owner

@pbek pbek commented Nov 1, 2018

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

Loading

@pbek pbek added this to the 18.11.0 milestone Nov 1, 2018
pbek added a commit that referenced this issue Nov 1, 2018
@pbek
Copy link
Owner

@pbek pbek commented Nov 1, 2018

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

Loading

@codito
Copy link
Author

@codito codito commented Nov 3, 2018

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

Loading

@pbek
Copy link
Owner

@pbek pbek commented Nov 3, 2018

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.

Loading

@codito
Copy link
Author

@codito codito commented Nov 3, 2018

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

Loading

@codito codito closed this Nov 3, 2018
@pbek
Copy link
Owner

@pbek pbek commented Nov 3, 2018

Great, thank you for testing!

Loading

@sanderboom
Copy link
Contributor

@sanderboom sanderboom commented Nov 5, 2018

Whoohah! this is an amazing improvement, cheers!!

Loading

@pbek
Copy link
Owner

@pbek pbek commented Nov 5, 2018

I'm happy you like it @sanderboom ;)

Loading

@pbek
Copy link
Owner

@pbek pbek commented Nov 7, 2018

18.11.1

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

Loading

@sanderboom
Copy link
Contributor

@sanderboom sanderboom commented Nov 7, 2018

This was exactly my next question 😋 Nice man!

Loading

pbek added a commit that referenced this issue Nov 7, 2018
@pbek
Copy link
Owner

@pbek pbek commented Nov 7, 2018

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

Loading

@codito
Copy link
Author

@codito codito commented Nov 11, 2018

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

Loading

@pbek
Copy link
Owner

@pbek pbek commented Nov 11, 2018

Awesome! :)

Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants