fabianmichael / kirby-markdown-field

Super-sophisticated markdown editor for Kirby 3, community built.
Other
160 stars 14 forks source link

Fix highlighting of empty lines in code blocks #96

Closed mtsknn closed 3 years ago

mtsknn commented 4 years ago

Fixes #62.


About line 141:

-if (state.f && state.f.name === 'local') {
+if (state.f == local) {

The original condition is always false because the code is minified when running npm run build and function names are thus not preserved.

Now state.f and the local function are compared directly, and it should work. (And state.f && is no longer necessary).

Side note: since I'm unfamiliar with the code base, I was at first confused what state.f is and wondered "why does this have a cryptic one-letter name?!" But okay, it's apparently a function, so I can see why it's named as just f. However, I think that state.fn would be clearer (I'd argue that "fn" is more common abbreviation of "function" than "f" is), and it would still be very succinct.


The changes on line 1037 and onwards are the same as the changes made by @fabianmichael (cheers!) in #62.

@fabianmichael, as you have apparently worked on this issue earlier, would you mind taking a look at this PR? 😊

fabianmichael commented 4 years ago

@sylvainjule As I haven’t replied yet. I currently don’t have time for digging into that. Please just merge, if you think it’s fine.

sylvainjule commented 3 years ago

Thanks a lot @mtsknn! 🍻 And apologies for the delay. Solves it for me, I refactored a few things so I added the fix by hand.