Skip to content
This repository has been archived by the owner on Feb 6, 2024. It is now read-only.

Support for highlightLines attribute #28

Closed
AhsanAyaz opened this issue Feb 15, 2021 · 10 comments · Fixed by #29
Closed

Support for highlightLines attribute #28

AhsanAyaz opened this issue Feb 15, 2021 · 10 comments · Fixed by #29
Labels
enhancement New feature or request

Comments

@AhsanAyaz
Copy link
Contributor

The deckdeckgo code component allows highlighting certain lines.
Adding the support in this package would be awesome!
https://docs.deckdeckgo.com/components/code/#app-components-highlight-code-examples

@peterpeterparker peterpeterparker added the enhancement New feature or request label Feb 15, 2021
@peterpeterparker
Copy link
Contributor

Sure good idea, we should add highlightLines to the list of pluginOptions

@peterpeterparker
Copy link
Contributor

I checked again but, I see an issue. The pluginOptions are global for the site. To the contrary, highlightLines is probably something you want to use on a particular piece of code of the website (like this code lines 1 to 3, that one 5 to 8).

Not sure how we should solve this, any idea ?

@AhsanAyaz
Copy link
Contributor Author

AhsanAyaz commented Feb 16, 2021

Yeah 😄
If it was just adding the pluginOption, you'd already have a PR from me 😄 .
I guess we'll have to think it through on how to do this. I'm gonna spend some time looking at this. Feel free to share any ideas that you get as well.

@peterpeterparker
Copy link
Contributor

Thanks for having a look, that would be really nice 😃.

Spontaneously I am thinking that instead of property/attributes maybe it can be solved with CSS4 variables. The component would had to be modified to read these but, it would allow users to specify lines even when using the plugin. Not sure it would work and there are probably better solutions. Looking forward to your ideas!

@AhsanAyaz
Copy link
Contributor Author

@peterpeterparker I did something ☝️ 🙂
The applies the attribute's value correctly to the <deckgo-highlight-code> properly. However, the deckgo-highlight-code component itself doesn't work fine with it for some reason. See the image attached:
Screenshot 2021-02-16 at 20 30 55

@peterpeterparker
Copy link
Contributor

thx for the PR @AhsanAyaz 🙏

it doesn't highlight lines because of the format. instead of 4 7, 20 35 it should parse 4,5 20,35, the coma being the separate for "from,to" and the space being the separator between "group".

would you like to give a try and let me know if it works out?

cool idea and solution 👍

@AhsanAyaz
Copy link
Contributor Author

Ah 😲 ! Now I got it.
Sure. Will implement the correct format and will update the PR.

@peterpeterparker
Copy link
Contributor

Awesome! keep me posted and let me know if I can do anything.

@AhsanAyaz
Copy link
Contributor Author

Just pushed the code to the PR with the right format and fixed tests.
Seems cool now:
image

@peterpeterparker
Copy link
Contributor

Sweet, looks good!

I'll test the PR with my website tomorrow after work. If all good (I have no doubt, looks cool), merge and release afterwards.

I keep you posted, good night.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants