Comments (4)
The way to change the TAB width in highlight.js
is in this issue: highlightjs/highlight.js#508
from emgithub.
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.
- https://stackoverflow.com/questions/50524579/how-to-set-tab-size-in-github-web-interface
- isaacs/github#170
- https://stackoverflow.com/questions/8833953/how-to-change-tab-size-on-github
Also I did a test, TABs in the files were rendered as 8 space width, on my PC and phone.
- https://github.com/yusanshi/embed-like-gist/blob/test/test-tab-width.java
- https://github.com/yusanshi/embed-like-gist/blob/test/test-tab-width.txt
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.
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.
I'll close this issue and merge the PR
from emgithub.
Related Issues (20)
- Theme request: arduino-dark HOT 3
- Hosting for demo GIF
- Rendering Jupyter Notebooks instead of showing raw code. HOT 4
- Fetch GitHub raw files from jsDelivr HOT 5
- Embeds Fail to Render After Forking Repository and Using Github Pages HOT 2
- File does not update HOT 3
- Cannot Embed on Medium HOT 4
- [Feature Request] Show Full Path in Footer HOT 4
- TypeError: Cannot read properties of null (reading 'querySelector') at embed-v2.js:422:33 HOT 4
- [FEATURE REQUEST] Embed Github commit diff HOT 1
- [Feature Request] Compile to static HTML HOT 7
- [Question] Use markers instead of line numbers HOT 1
- serviceProvider value is wrong if served from a subdirectory HOT 1
- [feature request] Add dark mode option for markdown files HOT 4
- [Request] full view render HOT 5
- Spaces indentation lost HOT 2
- Server Response is 404 - Can You Fix it HOT 4
- [Feature Request] Support multiple languages HOT 2
- Multiple `<script>` tags loaded for highlightjs
- Rendering the script tag version HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from emgithub.