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

Question: Indented output to terminal? #20

Open
bradwood opened this issue Jun 14, 2020 · 3 comments
Open

Question: Indented output to terminal? #20

bradwood opened this issue Jun 14, 2020 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@bradwood
Copy link

Hi,

Is there a way to print rendered markdown to the terminal with everything indented, say a few spaces? I don't want to use an alternate screen, or scrollable frame, just the text printed directly to the terminal.

This is what I have so far:

let desc_text =  i.description.unwrap();
    let mut area = Area::full_screen();
    area.pad(6,0);
    let md = skin.area_text(desc_text.as_str(), &area);
    print!("{}", &md);

This renders the text 6 characters narrower than the terminal width, now all I need to do is figure out how to indent this by 3 characters..

Any help is much appreciated. Thanks.

@Canop
Copy link
Owner

Canop commented Jun 15, 2020

I don't think there's currently a solution.

This looks like a good idea to support this. I'll have a look (but not immediately).

@Canop Canop self-assigned this Jun 15, 2020
@Canop Canop added the enhancement New feature or request label Jun 15, 2020
@bradwood
Copy link
Author

i found a crate called indented and was going to try that. The alternative (hacky) solution is to just do a regex replacement of \n with \n<space><space><space>...

What do you think?

@bradwood
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants