Skip to content

Reduce Prism.js bundle size by stripping unused languages and plugins - #865

Open
Amrit-raj50 wants to merge 8 commits into
git:masterfrom
Amrit-raj50:master
Open

Amrit-raj50 wants to merge 8 commits into
git:masterfrom
Amrit-raj50:master

Conversation

@Amrit-raj50

Copy link
Copy Markdown
Contributor

Optimizes syntax highlighting by updating script/prism.js to only include languages actually used across the repository, reducing the bundle size .

Changes

Kept languages:Markup, C-like, Bash (covering sh/shell), C, Diff, Git, and INI.
unused languages:Go, Python, Ruby, Perl, Makefile, JSON, YAML, and C++.
unused plugins:Autoloader and File Highlight.
Retained header comment:Preserved the official download configuration URL at the top of the file for future maintainability.

Note on Email Newsletter

Regarding syntax highlighting in the email version: Prism.js cannot run in email clients because JavaScript (<script> tags) is blocked for security. Achieving syntax highlighting in emails would require server-side pre-rendering with inline CSS (e.g., via Rouge/Jekyll) before publishing to Mailchimp.

Closes #862

@chriscool

Copy link
Copy Markdown
Collaborator

Thanks @Amrit-raj50 !

@sivaraam, since you were involved in the previous syntax highlighting improvements, can you take a look at this too?

Comment thread Gemfile Outdated
Comment thread _plugins/ruby3_compat.rb Outdated
Comment thread .bundle/config Outdated
@Amrit-raj50

Copy link
Copy Markdown
Contributor Author

@chriscool , @sivaraam could you review this , so that i can apply changes if any .

@sivaraam

Copy link
Copy Markdown
Member

Why is the prism.css unchaged? Would it not change too?

@sivaraam

Copy link
Copy Markdown
Member

Regarding the non-language content in your comment:

non-language contents --> Git Commit Graph/Log/Patch Header,Plain Text / Terminal Output / Benchmark

I think we can use the command-line plugin for terminal output.

Some helpful doc about this in README would be useful.

@Amrit-raj50

Amrit-raj50 commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor Author

thanks @sivaraam , i will check the README

@Amrit-raj50

Amrit-raj50 commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor Author

hi @sivaraam ,
I have reserched for the commandline styling and i get to know that
we can apply it in two different ways at first i will tell you the difference between them

  1. command line plugin :
    files need to add ---> prism-command-line.js + .css
    real senario:
    when a writer when writing in any .md file and he/she needs to want add commands in the file in the "command line plugin" senario
    he/she have to always repeat that which line is a output and which is a command with the help of a commnd below the real commands in the file
    i.e; {: .command-line data-output="..."}

but when he/she needs to update the commands in the file again he/she has to update the ; {: .command-line data-output="..."} , otherwise it rendered wrong way ....so this is constraint for using command line plugin.

  1. prim's console grammar :
    files need to add ---> prism-command-line.js
    same senario but here he/she do not have to count the line after any updation he/she just need to put $ any line without $ considered as output and with $ considered as input.

so , now tell me sir which one should i apply
and also i have to mention these changes in the CONTRIBUTING.md , for the writers to understand how to write commands in the files

thankyou

@Amrit-raj50

Copy link
Copy Markdown
Contributor Author

Why is the prism.css unchaged? Would it not change too?

there is no need to change the .css file it is already up-to-date

This branch has not been deployed

No deployments
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

Successfully merging this pull request may close these issues.

Some more enhancements to Prism based syntax highlighting

3 participants