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

Indentation in preformatted text #206

Closed
rhartmann opened this issue Feb 14, 2025 · 2 comments
Closed

Indentation in preformatted text #206

rhartmann opened this issue Feb 14, 2025 · 2 comments
Labels
bug Something isn't working

Comments

@rhartmann
Copy link
Contributor

There's a minor issue with the indentation being stripped off the first line of preformatted text and code blocks.

Example page:

# Preformatted

     Hello :) This is at 5 spaces.
     5 spaces here as well.

Rendered by GitHub:

Preformatted

 Hello :) This is at 5 spaces.
 5 spaces here as well.

Rendered by An Otter Wiki:

Image

Mistune preserves the leading space both in preformatted and code blocks:

>>> import mistune
>>> text = """# Preformatted
...
...      Hello :)
...      5 spaces
... """
>>> mistune.html(text)
'<p>&quot;# Preformatted</p>\n<pre><code> Hello :)\n 5 spaces\n</code></pre>\n'
                                         ^
>>> text = """# Code block
...
... ```
...  One leading space here
...  and here.
... ```
... """
>>> mistune.html(text)
'<h1>Code block</h1>\n<pre><code> One leading space here\n and here.\n</code></pre>\n'
                                 ^

An Otter Wiki should, too. Removing leading spaces hurts Otters like this one:

                                                                                      _____         
                                                                                   _----:_:::+*+:   
                                                                               _:-=-_ _:_    =*++:  
                                                                            _-=-_     _:_       =-_ 
                                                                          _-+#*=_             _-#-  
                                                                         _::_=+=_           :+#*-_  
                                                                         ==               :**#*-    
                                                                         ==              :==_::_    
                                                                        :-:               -+___     
                                                                        +:                _=:_      
                                                                       _+:                 _*:      
                                                                      _:-_                 _+-      
                                                                      :+_                   =-_     
                                                        _::--==+++****#*_                   --_     
                                                __:-=+++=--::_____   :+*_                   --_     
                                             :=+=:___                :+#_                   =-_     
                                         _:=+-_                      _=P-_                 _*=_     
                                       _==-_                          -#+_                 :#=_     
                                     _-+:                             _=#-                :*P-      
                                    ==:                                _+=:              _=P#:      
                                  :+=_                                   -=_             =#P+_      
                                 -+:                                       _            =#P#_       
                                ==:                                                   _=PP*-        
                              _:+:                                                   :+PPP+         
                              :+:                                                   -#PPP#=         
                              :+_                                                  _#PPPP*-         
                              :=                                                   :#PPPP*:         
                              :=                            _:-=====-:__          _-+#PPPP+:        
                              :+                        _-*PPPPP#+-__:-++=:_      _--=*PPPPPP*=:    
  _:=+****+=-:_               :*_                    _=#PPPPP#+:_        __-+=:   _==__+PPPPPPP#=_  
       _-+*#PPPP##*+======++*#PP:_                 _=#PPPPP#=_               :+#**#PP#=:-+#PPPPP=_  
            __:-=*#PPPPPPPPPPPPP*:                :*PPPPP+:                    :*PPPPPPP#-_:****-_  
                     _:=+*###PPPP+:              :*PPPPP#-                       _=#PPPPP*:         
                           ___:-+*#+:           -#PPPPPPP#*-                        :*PPPP#=        
                                  _+##*=:_____-+PPPPPP#****=                         _=*+##*_       
                                    _:-=+#PPPPPPPP#+:_                                   ___        
                                         _=PPPPPPP=                                                 
                                          _-=+++=:_                                                 
@redimp redimp added the bug Something isn't working label Feb 14, 2025
@redimp
Copy link
Owner

redimp commented Feb 14, 2025

An Otter Wiki should, too. Removing leading spaces hurts Otters like this one:

😂 A well-presented case.

@redimp redimp closed this as completed in 680f74a Feb 17, 2025
@redimp
Copy link
Owner

redimp commented Feb 26, 2025

Fix released in v2.9.4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants