RickStrahl / MarkdownMonster

An extensible Markdown Editor, Viewer and Weblog Publisher for Windows
https://markdownmonster.west-wind.com
Other
1.59k stars 236 forks source link

Crash in Interactive Table Editor when pasting Table without Headers #624

Closed pmgeuze closed 4 years ago

pmgeuze commented 4 years ago

Mr. Strahl,

I am coming across this error when I am using the Interactive Table Editor to paste->convert->embed delineated data as a table.

I believe that this is caused when the delineators do not make equal columns, or if the delineators are directly together without any space and are not seen as delineators .

Let me know if this is a unique issue that I need to use a different delineator. I prefer the pipe since it allows me to keep quote marks in messages that would be data on the table.

Pasted data |Investigator |Paul Keener| |Badge| #3377| |Detetcive - Crimes Against UNIT| |Digital Forensics Examiner |Detecive Pm. Geuze| | |Technology Based Crimes Unit| | | Cobb County Police Department | | | Marietta, Ga | | | 770.499.3900| |SUBJECT | Digital Forensics Examination Report| |Accused 1NAME| |Offences| Stalking| |Additional Accused | Andres Arturo Villagomez| |Offences | Unlawful disclosure or promotion of intimate visual| |Date of Request| DATE| |Date of Conclusion| DATE| |Report Publish Date| DATE|

I see the error on line 3 and 10 where there is not an additional "|" to make two columns. I also get the same error if I use "||" where the two delineators are together with no space to show the column.

Pasted data ready to embed just before error message image

Error message image

I can usually recover the program, but on occasion MM will close and exit. On restart, I see no loss of data or other errors.

Error Log MarkdownMonsterErrors.txt

RickStrahl commented 4 years ago

I can duplicate that and it's a bug. No matter what it shouldn't crash.

As to formatting create a table in the editor then paste it to see the 'correct' syntax that should be used. If I remember right the spaces are required in order for valid Markdown to render - your text as is doesn't get rendered by MarkDig either so it's not valid Markdown . The issue in this case is that there's no header and I guess a header is required in order to identify the table as a Pipe Table.

If you add:

| Name | Unit |
|--------------|------------|
| Investigator |Paul Keener |  
| Badge| #3377 |

it renders. Without the header, it does not.

pmgeuze commented 4 years ago

Rick,

Thank you for your follow up. I see that it is my fault for 'forcing' the Table Editor to the "out of range" error.

On my end, I will set the tab to table macro to space dividers in the future, and I will check my tables for equal columns.

So I see that it is just something I need to watch on my end. I still really enjoy the Paste->Embed function from the Table Editor.

RickStrahl commented 4 years ago

While the format you're using may be incorrect, this is still a bug - it shouldn't crash - if anything it should just not do anything if it can't process the table, so this needs to get fixed.

Re-opening to get this fixed in a future update.

RickStrahl commented 4 years ago

I think the crash issue fixed with the recent updates that are explicitly adding columns for headers and content to match the widest row in the table.

Pasting your original text:

|Investigator |Paul Keener|
|Badge| #3377|
|Detetcive - Crimes Against UNIT|
|Digital Forensics Examiner |Detecive Pm. Geuze|
| |Technology Based Crimes Unit|
| | Cobb County Police Department |
| | Marietta, Ga |
| | 770.499.3900|
|SUBJECT | Digital Forensics Examination Report|
|Accused 1NAME|
|Offences| Stalking|
|Additional Accused | Andres Arturo Villagomez|
|Offences | Unlawful disclosure or promotion of intimate visual|
|Date of Request| DATE|
|Date of Conclusion| DATE|
|Report Publish Date| DATE|

into the table editor (or using Edit Table in the editor itself) ends up with this in the table editor:

image

Note that pipe tables and grid tables require a header or else it won't render as markdown. So the original Markdown pipe table is effectively invalid Markdown.

The table editor still is able to pick it up but it will turn the first row into a header and when you paste it back. The pasted, cleaned up Markdown then looks like this:

| Investigator                    | Paul Keener                              |
|---------------------------------|------------------------------------------|
| Badge                           | #3377                                    |
| Detetcive - Crimes Against UNIT |                                          |
| Digital Forensics Examiner      | Detecive Pm. Geuze                       |
|                                 | Technology Based Crimes Unit             |
|                                 | Cobb County Police Department            |
|                                 | Marietta, Ga                             |
|                                 | 770.499.3900                             |
| SUBJECT                         | Digital Forensics Examination Report     |
| Accused 1NAME                   |                                          |
| Offences                        | Stalking                                 |
| Additional Accused              | Andres Arturo Villagomez                 |
| Offences                        | Unlawful disclosure or promotion of intimate visual |
| Date of Request                 | DATE                                     |
| Date of Conclusion              | DATE                                     |
| Report Publish Date             | DATE                                     |

The thing to do with this is to paste it back and then add an explicit header row that has actual column headers and move the top line down. But best to remember that tables in Markdown require a header.