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

Feature: Mobile Optimized Codebocks + Language Interpretation #1045

Closed
Mentors4EDU opened this issue Feb 8, 2021 · 8 comments
Closed

Feature: Mobile Optimized Codebocks + Language Interpretation #1045

Mentors4EDU opened this issue Feb 8, 2021 · 8 comments
Labels
Needed: more information A reply from issue author is required

Comments

@Mentors4EDU
Copy link

Problem

Code blocks don't resize or aren't dynamic in mobile responsive views

Reproducible Project

Pytorch's Sphinx theme is able to have responsive codeblocks, but unsure how to integrate this to the regular rtd theme

Other

Sphinx has some language interpretation, but XML, YAML, Java, Puppet, etc. don't seem to render as well in the codeblock
.. code:: LANG arguments

This is a feature request I want to subscribe to, not a bug

@stsewd
Copy link
Member

stsewd commented Feb 8, 2021

Sphinx has some language interpretation, but XML, YAML, Java, Puppet, etc. don't seem to render as well in the codeblock

Do you have some examples? I think that's mostly to do with pygmets (the lib is used to parse/lex different languages in code blocks)

@stsewd stsewd added the Improvement Minor improvement to code label Feb 8, 2021
@Blendify
Copy link
Member

Blendify commented Feb 8, 2021

Sphinx has some language interpretation, but XML, YAML, Java, Puppet, etc. don't seem to render as well in the codeblock

Do you have some examples? I think that's mostly to do with pygmets (the lib is used to parse/lex different languages in code blocks)

Correct, changes to add or improve different languages should be handled in https://pygments.org/ and sphinx.

@Mentors4EDU
Copy link
Author

It is strange though, because pygments supports many of these languages, but unsure why they are rendering in GitHub but not in the readthedocs. Is it a problem tied to sphinx or this theme? Though, I would be interested in the other issue I have more w/ codeblocks which is resizing. Both of them could be an improvement one way or the other

@stsewd
Copy link
Member

stsewd commented Feb 9, 2021

It is strange though, because pygments supports many of these languages, but unsure why they are rendering in GitHub but not in the readthedocs. Is it a problem tied to sphinx or this theme?

That would be a sphinx problem, yes.

Also, for the original problem, do you mean that code blocks should wrap long lines instead of adding an scroll bar?

Screenshot_2021-02-09 Configuration File V2 — Read the Docs 5 8 5 documentation

Screenshot_2021-02-09 Extending PyTorch — PyTorch 1 7 1 documentation(1)

Personally I don't like wrapping, and I'm not sure if that's required for mobile, maybe an option? this can also be done by adding a custom css rule I guess.

The change is

to wrap lines that can be changed to pre-wrap

@stsewd stsewd added Needed: design decision A core team decision is required and removed Improvement Minor improvement to code labels Feb 9, 2021
@Mentors4EDU
Copy link
Author

No I am saying let us say I want a single line like
curl -sL https://raw.githubusercontent.com/slap-editor/slap/master/install.sh | sh that line cuts off on mobile because it is too many characters rather then wrapping. For large code blocks, it isn't as much as a problem. Resizing for long lines of code or some sort of optimization in regards to long lines of code would be nice.

@stsewd
Copy link
Member

stsewd commented Feb 10, 2021

@Mentors4EDU I think you mean #321?

@stsewd stsewd added Needed: more information A reply from issue author is required and removed Needed: design decision A core team decision is required labels Feb 10, 2021
@Blendify
Copy link
Member

It is strange though, because pygments supports many of these languages, but unsure why they are rendering in GitHub but not in the readthedocs. Is it a problem tied to sphinx or this theme? Though, I would be interested in the other issue I have more w/ codeblocks which is resizing. Both of them could be an improvement one way or the other

Sphinx uses a very old version of pygments, I am sending a PR to update to a newer version which adds many new languages.

@Blendify
Copy link
Member

Closing as a duplicate of #321, if you find this is a separate issue please reopen this report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needed: more information A reply from issue author is required
Projects
None yet
Development

No branches or pull requests

3 participants