axiros / terminal_markdown_viewer

Styled Terminal Markdown Viewer
Other
1.8k stars 105 forks source link

(1) Line endings not being recognised & (2) Text formatting in tables being ignored #100

Open Whyglobaleyes opened 2 years ago

Whyglobaleyes commented 2 years ago

Hello, Apologies in advance. Just installed mdv so I might be asking v stoopid Q here - BTW I already LOVE it ... turned into a pretty commandline viewer for obsidian, all the speed of terminal w/out loosing the looks!

So I'm trying to display an md file and make it look something like a two column table with the text in one column emphasised in some way [approx like the last column "desired" in the screenshot - the top row is the text file itself, the middle row is how mdv shows it].

  1. The files I'm working from were written ages ago - I used spaces (not tabs) to align everything and a double pipe || as an arbitrary marker :: when I passed it through mdv all the line-breaks vanished. [screenshot col 1 'browser']
  2. I tried stripping out tabs and doubles-paces, then all the trailing whitespace, then all the possible special characters [screenshot col 3 browser attempt 2] ==> none of that worked
  3. I tried doing a search for \n and \r but neither of those was found - which I thought was weird.
  4. The only way I found of fixing it was to put an extra line-break into my original files [screenshot col 2: "browser_repair"].
  5. The same problem affected a newly created file with lines of about 75 characters, but not the shorter ones [screenshot col 4 "test"
  6. Because of the oddity with \n and \r I thought I should check the encoding of the files (bottom row of the screenshot] and they're all us-ascii ==> I tried converting it to a UTF-8 version but that didn't seem to help either.
  7. TBH a table structure would be much more elegant for the future; I can convert all my original files so I tried that but for some reason the emphasis syntax didn't show up within the table [col 4] :: but - and this really mystified me - the in-table emphasis shows up properly if I use the sample code [col 5]

So, I'm at a loss. It really feels like I'm doing something very very dim. I've tried dozens of variations but none work; and TBH it's pretty ill-informed monkey-keyboard bashing because I don't understand enough to know why my original files or my attempt at a new table aren't being processed as expected. Can anyone help me please?

image

EDIT - SUCCESS - Sort of. I've realised that I can show bold and emphasis formats within a table if and only if I insert a plain character between the pipe | marker for the tablestructure and the star character(s) for the textformat ==> the Z and the A that I inserted in a few lines of the table in column 4. Basically I can do what I want but I don't understand how/ why