Comments (12)
@RebelCoderRU:
I will wait for you to add the package to the packagist. Let me know when you have done that
I published it on packagist and just released v0.2.0 that adds highlighting in the preview: https://packagist.org/packages/club-1/flarum-ext-server-side-highlight
and also how can I tip you? I don't see a tip/support on your GitHub page.
I did not take the time/motivation to setup it, I just applied for GitHub sponsors but it takes some time to receive the validation.
from framework.
@RebelCoderRU: you should open an issue in my repo. It looks like there are two problems here. First I should add a note about the fact that the messages need to be reparsed (for example by editing them). Also it seems the dark theme is not properly detected, are you not using the "dark mode" switch in the appearance settings of Flarum ?
from framework.
Apparently, this was reported in 2020: https://discuss.flarum.org/d/22635-how-to-change-syntax-highlighting/20
from framework.
In the interest of eventually allowing CSP headers and removing scripts from textformatter content, maybe the correct action here would be removing highlighting this way in favor of explicitly calling highlightjs.
from framework.
In the interest of eventually allowing CSP headers and removing scripts from textformatter content, maybe the correct action here would be removing highlighting this way in favor of explicitly calling highlightjs.
I have tried the highlight.js
extension, and it seems to be broken (syntax highlighting is broken, does not "respect" the theming):
from framework.
I am wondering if there is some kind of hack/workaround for this, as I am waiting for this to work to start my community, which is code/programming focused, and this is one of the main features I need to work.
from framework.
I started thinking about making a Flarum extension that would do server-side code highlighting. It would produce a "highlight.js compatible" HTML result while parsing the newly posted messages, this way the code parsing and highlighting is only done once. The clients would only have to include a CSS stylesheet.
I will post an update if I finally start to do it.
from framework.
I started thinking about making a Flarum extension that would do server-side code highlighting. It would produce a "highlight.js compatible" HTML result while parsing the newly posted messages, this way the code parsing and highlighting is only done once. The clients would only have to include a CSS stylesheet. I will post an update if I finally start to do it.
Got you. Do you know of any workaround that could be used now, as I am blocked from starting my community for a few weeks now, because of this bug?
from framework.
So I started this extension today: club-1/flarum-ext-server-side-highlight.
It works well but is still has a few issues that I would like to address:
the highlighting is not shown in the previewEdit: done in v0.2.0- the themes are not configurable
That said it currently provides the following advantages:
- the highlighting is done on the server so it is not up to the clients to do it
- the server uses the cache to save highlighted blocks to only do the processing once
- it works without any JS so even on the worst web browser the highlight will be there and there is no delay before the highlighting is applied
- the theme adapts itself to the "dark mode" setting of Flarum
- it works even with BBCode extension disabled (See s9e/TextFormatter#206)
If you want to try it you can use the "repository" feature of composer, but I will probably create the package on packagist soon.
from framework.
@n-peugnet Thank you so much. I will wait for you to add the package to the packagist. Let me know when you have done that, and also how can I tip you? I don't see a tip/support on your GitHub page.
from framework.
@n-peugnet Just tested it and it has highlighting/theme issues:
But the highlighting works during the editing:
Do I need to disable some other extension?
from framework.
are you not using the "dark mode" switch in the appearance settings of Flarum ?
Yes, correct.
messages need to be reparsed (for example by editing them)
Yes, I have tried that, and it seems to work as expected, after I Edit -> Save.
How hard is it to change the theme of the highlighting? Even though it now works, colors are very bad, hard to read:
Current version:
Desired version (or at least as readable in both, dark and light mode):
from framework.
Related Issues (20)
- Export Registry
- `authenticatedAs` option does not work with `/admin` routes in integration tests
- PostStreamScrubber shows "0 UNREAD" when reply composer is open HOT 2
- "Mentioned by" on posts sometimes leaks hidden posts HOT 5
- LogInController doesn't handle validation exceptions properly
- Code Splitting
- Flarum ColorInput textbox issues
- Increasing the number of discussions shown per page HOT 6
- `DiscussionTaggedPost` might show "deleted" when tag is secondary
- Forum not working in IE11 HOT 1
- Provide a ForumPage (or something like that) that contains the sidebar can inherit from HOT 7
- bug happens when replying again HOT 1
- Search drivers HOT 2
- typo in js part of sticky plugin HOT 5
- Missing Component Exports
- DispatchEventsTrait causes error when event does not have "actor" attribute due to PHP 8.2 deprecation HOT 4
- Setting permissions on mobile does not display correctly on mobile
- PostRepository::getIndexForNumber() walks 2 time the posts table to get offset HOT 6
- Code blocks are hard to read in dark mode HOT 2
- [1.x] `Conditional` extender instantiates the extenders array even when the conditional is false
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 framework.