Search code examples
githubgist

How to soft wrap line in Github Gist


I have a long string that I want to embed in my blog using Github Gist. I want to enable line-wrap for it, so that readers don't have to scroll right to view the entire string. Even after clicking the 'soft-wrap' option while editing, the final gist is not wrapped.

While editing (Soft-wrap enabled):

enter image description here

After saving (No line-wrap):

enter image description here How can I fix this?


Solution

  • Github doesn't soft wrap any of the code files, including txt files. Wrapping is only applied to prose documents, such as markdown and rst documents.

    The solution to your problem would be to rename gist from sample_text.py to sample_text.md and apply Soft wrap. That would produce desired effect you want to achieve.

    Read this conversation on Github community for more context.