Canop / termimad

A library to display rich (Markdown) snippets and texts in a rust terminal application
MIT License
903 stars 31 forks source link

How do I disable tables in Madskin? #61

Closed sevenuz closed 6 months ago

sevenuz commented 6 months ago

I do not want to print tables in certain cases but want to use normal |hier|there| How can I reset the style of tables?

Canop commented 6 months ago

You want an option to hide tables ?

sevenuz commented 6 months ago

Yes, so that tables are printed as normal ascii. With the option limit_to_ascii(), the tables use normal | but the indention and color still changes. Alternatively, how do I print normal output in a scroll view? With print!() it changed the indention and line breaks. Thank You for the quick reply!

Canop commented 6 months ago

I'm sorry but I still miss your intent. Do you want to print the raw markdown, not interpreted ? What's "normal output" ? Is your question about wrapping ?

sevenuz commented 6 months ago

yes not interpreted. But I will search for another solution, maybe it makes no sense.

Canop commented 6 months ago

Actually, a text-view for basic text, without markdown interpretation, would be quite easy to add to termimad and would be consistent, but I never needed it so I didn't build it.

sevenuz commented 6 months ago

That would be nice, I also found

    // another one: see that the arguments aren't interpreted as markdown,
    //  which is convenient for user supplied texts
    mad_print_inline!(&skin, "**$0:** ` area = $2 ` and ` perimeter = $1 `", "Disk", "2*π*r", "π*r²");

in the inline-template example. How would I use it in a scrollview?

sevenuz commented 6 months ago

My workaround now is, that I put a blank space in front of the table. This avoids the rendering.

But now I have another problem. From an indentation of 3, the scrollview starts a new line. Why?

format!( "{:indent$} {}", "", text, indent = 3);
sevenuz commented 6 months ago

Okey, my workaround for that is

‎‎format!( "{:indent$} {}", "‎<200e>", text, indent = 3); ‎ ‎ 

The left-to-right mark (LRM) is a control character (an invisible formatting character).

Kind of a hack but it works :D