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

equations in docs #28

Open
robgal519 opened this issue Mar 10, 2019 · 7 comments
Open

equations in docs #28

robgal519 opened this issue Mar 10, 2019 · 7 comments

Comments

@robgal519
Copy link

robgal519 commented Mar 10, 2019

When I opened man page for std::normal_distribution I found out that the equation is not displayed correctly.
It looks like this:
f(x; μ,σ) =

              1
              σ
              √
              2π

              exp⎛
              ⎜
              ⎝

              -1
              2

              ⎛
              ⎜
              ⎝

              x-μ
              σ

              ⎞
              ⎟
              ⎠2
              ⎞
              ⎟
              ⎠

and it should be all in one line.

@theidexisted
Copy link
Contributor

theidexisted commented Nov 20, 2020

This is a bug in elinks, which is an independent program, we spawn subprocess to run elinks and render the HTML pages.

The lastest update for elinks is 2012-10-30, so I would not expect them to fix it.

@theidexisted
Copy link
Contributor

@jeaye Could you please review this issue?

@jeaye
Copy link
Owner

jeaye commented Nov 20, 2020

I've recently been thinking about trying out https://www.brow.sh/ instead of elinks. It should offer much better rendering, since it just uses a headless Firefox. The only question would be around rendering a full frame to a string and pulling out the content we need. If you're looking for something to dig into, that would be a huge step for stdman's formatting.

@theidexisted
Copy link
Contributor

theidexisted commented Nov 27, 2020

@jeaye
Thanks for your guide, I have tried with Browsh, but it can't rend the equation correctly, though it's much better than Elinks

img

@theidexisted
Copy link
Contributor

theidexisted commented Nov 27, 2020

I have also tested Browsh for this page:
https://en.cppreference.com/w/cpp/string/basic_string

For the Helper classes section, Browsh rend it as:

 Helper classes                                                                                
        std::hash         (C++11)                                                        
        std::hash       (C++20)                                                        
        std::hash      (C++11)                                                        
        std::hash      (C++11)                                                        
        std::hash        (C++11) hash support for strings                               
        std::hash    (C++20) (class template specialization)                        
        std::hash  (C++20)                                                        
        std::hash (C++20)                                                        
        std::hash (C++20)                                                        
        std::hash   (C++20)   

Which is still not perfect.

For elinks, it generates:

Helper classes                                                                                                                                                            
          std::hash<std::string>                                                                                                                                          
          std::hash<std::u8string>                                                                                                                                        
          std::hash<std::u16string>                                                                                                                                       
          std::hash<std::u32string>                                                                                                                                       
          std::hash<std::wstring>                                                                                                                                         
          std::hash<std::pmr::string>                                                                                                                                     
          std::hash<std::pmr::u8string>                                                                                                                                   
          std::hash<std::pmr::u16string>                                                                                                                                  
          std::hash<std::pmr::u32string>                                                                                                                                  
          std::hash<std::pmr::wstring>   hash support for strings                                                                                                         
          (C++11)                        (class template specialization)                                                                                                  
          (C++20)
          (C++11)                                                                                                                                                         
          (C++11)                                                                                                                                                         
          (C++11)                                                                                                                                                         
          (C++20)                                                                                                                                                         
          (C++20)                                                                                                                                                         
          (C++20)                                                                                                                                                         
          (C++20)                                                                                                                                                         
          (C++20)        

Browsh looks better, but still not ideal.
Of course, this may also be due to the cpprefencen template itself has some problems, I can not copy this paragraph in its original style. When I copy the table and paste, we get the text in mess:

std::hash<std::string>std::hash<std::u8string>std::hash<std::u16string>std::hash<std::u32string>std::hash<std::wstring>std::hash<std::pmr::string>std::hash<std::pmr::u8string>std::hash<std::pmr::u16string>std::hash<std::pmr::u32string>std::hash<std::pmr::wstring>(C++11)(C++20)(C++11)(C++11)(C++11)(C++20)(C++20)(C++20)(C++20)(C++20) | hash support for strings(class
-- | --

@jeaye
Copy link
Owner

jeaye commented Nov 27, 2020

Thanks so much for testing this. It does seem like cppref may be the issue for the the last bit. Copy/paste is always a good test for how things will render in text.

Outside of that, though, browsh does a much nicer job than elinks. Do you see any potential issues in stdman using browsh for generation instead? The only thing I noticed is that browsh is rendering ads; I wonder if we can configure it to use uBlock Origin. If not, we can just cut out that bit of the HTML.

@theidexisted
Copy link
Contributor

I will make a proposal later, I need to go through the current source code of stdman

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

3 participants