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

Code block weirdness #124

Closed
niblo opened this issue Jul 29, 2020 · 5 comments
Closed

Code block weirdness #124

niblo opened this issue Jul 29, 2020 · 5 comments
Labels

Comments

@niblo
Copy link
Contributor

niblo commented Jul 29, 2020

Input (extra empty line at the beginning for better readable output); the row of A's is indented by 17 spaces:

```
A                A
                 A
                 A
                 A
```

Output:

<pre><code>
A                A
                A
                A
                A
</code></pre>

But look at this; the row of A's is indented by 16 spaces instead of 17:

Input:

```

A               A
                A
                A
                A
```

Output:

<pre><code>
A               A
                A
                A
                A
</code></pre>

Anything below an indent of 17 spaces seems ok.


I just used a column of A's to see the results better; here's a minimal case:

```

A
                 B
```

Output (one less space before the 'b':

<pre><code>
A
                B
</code></pre>

Even more minimal:

```
                 B
```

Output (one leading space stripped off):

<pre><code>                B
</code></pre>

It doesn't seem to happen if you indent by less than 17.

@mity
Copy link
Owner

mity commented Jul 29, 2020

I cannot reproduce with md2html utility in the current head:

$ printf 'A                A\n                 A\n                 A\n                 A' | ./md2html/md2html
<p>A                A
A
A
A</p>

Are you using some non-default flags or something?

@mity
Copy link
Owner

mity commented Jul 29, 2020

The first examples are not valid code blocks at all because the 1st line is not indented enough.

When trying the "more minimal" test case, I still can't see any problem:

$ printf '                 B'  | ./md2html/md2html
<pre><code>             B
</code></pre>

The input has exactly 17 spaces of indentation, the output (between <code> and B) has 13 spaces (which is imho ok because 13 = 17 - 4).

@niblo
Copy link
Contributor Author

niblo commented Jul 30, 2020

I forgot to mention that it was fenced code blocks, and I forgot to add in the fences in the input examples. I updated the examples now.

@mity mity closed this as completed in c595c2e Jul 30, 2020
@mity
Copy link
Owner

mity commented Jul 30, 2020

Fixed. Thanks for reporting it.

@mity mity added the bug label Jul 30, 2020
@niblo
Copy link
Contributor Author

niblo commented Jul 30, 2020

Thanks.

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

No branches or pull requests

2 participants