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

Proper text wrapping of long descriptions #85

Closed
tomghyselinck opened this issue Feb 2, 2024 · 4 comments
Closed

Proper text wrapping of long descriptions #85

tomghyselinck opened this issue Feb 2, 2024 · 4 comments

Comments

@tomghyselinck
Copy link

Hi,

We like this project very much!

One thing which makes documentation hard to read for our users is when the description contains long lines of text.

It seems that those are not properly wrapped (like is done in a normal section in sphinx documentation).
Instead we get a scroll bar below the schema. For large schema's this becomes quite cumbersome to read the documentation:

  • read a part,
  • scroll down below the schema,
  • scroll the schema right,
  • scroll up back to the part you were reading
  • and again for the next part of the line

For example:

Can you tell us how to avoid this? Is there some styling (CSS?) parameter we can add / change to our documentation? Is there a different option we can set?

@lnoor
Copy link
Owner

lnoor commented Feb 2, 2024

Thank you for the compliment.
I am pleased to hear it is of use to you.

A schema is rendered by creating a grid table for it.
So it is turned in a set of rows with cells each containing one item.

Thus a schema is transformed into

+--------------------------------------------------------------------------------------- +
|Configuration parameters for a ByteBlower Port or ...             |
+=================================================+
|Configuration parameters for a ByteBlower Port or ...            |
+---------------------+----------------------------------------------------------------+
| type                 | object                                                                   |
+--------------------+---------------------------------------------------------------- +
| properties                                                                                        |
+--------------------+-----------------------------------------------------------------+
| - name            | Name of this ByteBlower traffic endpoint ... |
|                         +--------+-------------------------------------------------------+
|                         | type | string                                                        |
+--------------------+--------+------------------------------------------------------+
| - port_group | List of port group where this port belong... |
|                        +-------+--------------------------------------------------------+
|                       | type | array                                                           |
+------------------+---------+-------------------------------------------------------+

(didn't check for validity, I'm sure you understand what I'm trying to say).

In fact all parts of a schema are expressed using existing reStructuredText elements.
So it becomes just a plain table that can be styled as your other tables.
Unless you have defined custom css classes for your tables.

There is no support assigning css classes to individual tables.
The reason is that I needed the result to be renderable to epub and pdf as well as the web.

I had the same problem as you and my solution is to make extensive use of $ref references and having anchors and links to let the viewer jump to the definition of the reference.
That way I could 'flatten' the depth of the tree so it also looks good on a printed page.

One thing I do not really understand is why the regular text in the descriptions isn't wrapped within the available width.
Did you disable wrapping using css?

I'm sorry I cannot be of more help at the moment.

@tomghyselinck
Copy link
Author

Hi @lnoor,

Thank you for the extended information!

We are indeed already using $ref extensively too (well, as long as relevant to split off).

We have a custom CSS, but as far as I know, text wrapping shouldn't be disabled.
I will have a look to be sure.
But that is indeed our main issue at the moment, I'll get back to this if I have a better clue on what is going wrong here.

With best regards,
Tom.

@tomghyselinck
Copy link
Author

Hi @lnoor,

FYI: I found and solved the issue: It was related to the sphinx-rtd-theme: readthedocs/sphinx_rtd_theme#1246

See also https://stackoverflow.com/questions/69359978/grid-table-does-not-word-wrap

@lnoor
Copy link
Owner

lnoor commented Feb 7, 2024

Hi @tomghyselinck,

I'm glad you found the cause and a work-around.
I will then close this ticket.
Feel free to reopen if you see any reason to do so.

With regards,
Leo

@lnoor lnoor closed this as completed Feb 7, 2024
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