Code Monkey home page Code Monkey logo

Comments (4)

fantasticmao avatar fantasticmao commented on September 25, 2024

The way to change the TAB width in highlight.js is in this issue: highlightjs/highlight.js#508

from emgithub.

yusanshi avatar yusanshi commented on September 25, 2024

Thanks for your suggestions!

All the changes are made at branch improve-code-display. You can try and test yourself. If that is OK to you, we can merge it into master :)

TAB width

Sorry but after searching it seems that 8 is the default width for TAB.

Also I did a test, TABs in the files were rendered as 8 space width, on my PC and phone.

image

So I think directly setting TAB size to 4 is not ideal.

However, on GitHub web surface, TAB width can be specified by ?ts=X, I think we can take it into this project. Although hljs.configure({tabReplace: ' '}) does work, I didn't use this since it will modify the original content, i.e. you copy the code but all TABs become spaces. I use CSS style tab-size: X instead. In fact, I found that GitHub implements ts=X using tab-size: X.

Currently, https://github.com/yusanshi/embed-like-gist/blob/test/test-tab-width.java?ts=2#L2-L4 in this project should behave basically the same as it does on GitHub web interface.

Font size

Make sense! Changed to 12px.

Id and class

Good suggestion! Currently id is used to locate DIV (to support the same code embedded many times, a random string instead of params.toString() is used).
Also, The outermost div has a class attribute emgithub-container. So you can do any hacks you want.

from emgithub.

fantasticmao avatar fantasticmao commented on September 25, 2024

Well, it may be that .editorconfig affects the TAB size on GitHub 😅

I have tested them all and everything is working fine! Thank you very much!

from emgithub.

yusanshi avatar yusanshi commented on September 25, 2024

I'll close this issue and merge the PR

from emgithub.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.