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

Extra space in argument's rendered markdown #363

Open
Boshen opened this issue May 23, 2024 · 3 comments
Open

Extra space in argument's rendered markdown #363

Boshen opened this issue May 23, 2024 · 3 comments

Comments

@Boshen
Copy link
Contributor

Boshen commented May 23, 2024

Rendered example:

image

Concrete example from test case codeblock_ticks_help:

- **` --verbose`** — \n Verbose help

After an hour of debugging I found it's inserting the space here

buf.write_str(" --", Style::Literal);

but removing it will break everything else.

And I wasn't able to hack it in the markdown renderer, the input

let input = &self.payload[byte_pos..byte_pos + bytes];

came in as

[src/buffer/html.rs:327:21] input = "    --verbose"

so the split below

for chunk in split(input) {

produces

[src/buffer/html.rs:335:31] chunk = Raw(
    " ",
    1,
)
[src/buffer/html.rs:335:31] chunk = Raw(
    " ",
    1,
)
[src/buffer/html.rs:335:31] chunk = Raw(
    " ",
    1,
)
[src/buffer/html.rs:335:31] chunk = Raw(
    " ",
    1,
)
[src/buffer/html.rs:335:31] chunk = Raw(
    "--verbose",
    9,
)

and I don't know what to do next, hence this issue 😅

@pacak
Copy link
Owner

pacak commented May 23, 2024

Hmm... I'll see what I can do. I'm not really 100% happy with how markdown rendered either.

@Boshen
Copy link
Contributor Author

Boshen commented May 23, 2024

Hmm... I'll see what I can do. I'm not really 100% happy with how markdown rendered either.

Side note: for other data sources I ended up parsing to another data structure and render some markdowns ... e.g. json schema to markdown: https://github.com/oxc-project/oxc/blob/main/tasks/website/src/linter/json_schema.rs

Maybe it's better to construct a data structure instead of collecting to html and then render from the html, the user could can use the data structure instead.

But this is a lot of rework 😅

@Boshen
Copy link
Contributor Author

Boshen commented May 23, 2024

Thanks for the quick response!

While we are at it, my weirdly added doc comment https://github.com/oxc-project/oxc/blob/3671b5c4d0a56a2edd005bbd8710036ee61376d2/crates/oxc_cli/src/command/lint.rs#L79 produced something that looks like a missing newline

**Allowing / Denying Multiple Lints**###  For example `-D correctness -A no-debugger` or `-A all -D no-debugger`. ㅤ

Notice there is no newline before ###.

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

No branches or pull requests

2 participants