Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

withClass annotation is not working #354

Closed
lavr001 opened this issue Apr 15, 2023 · 10 comments
Closed

withClass annotation is not working #354

lavr001 opened this issue Apr 15, 2023 · 10 comments

Comments

@lavr001
Copy link

lavr001 commented Apr 15, 2023

Hello,

I'm following this code hike docs to implement a withClass annotation to make the first line bold here is my code:

# withClass[1:45] bold

? Enter a name for the project reactamplified
The following configuration will be applied:

here is my css:

.bold {
  font-weight: bold;
}

And instead of applying the styling from the bold class, I see this # withClass[1:45] bold
in the code container:

Screenshot 2023-04-14 at 5 46 38 PM

Any suggestions?

@pomber
Copy link
Contributor

pomber commented Apr 15, 2023

Hi,

The comment syntax depends on the language. Currently the comment detection isn't super smart, if # withClass doesn't work, it probably means you need to use // withClass.

@lavr001
Copy link
Author

lavr001 commented Apr 15, 2023

It kind of worked, thank you. Can you apply withClass annotations with lines, instead of columns? I tried to use it twice in one step, and it only worked the first time.

Does code hike have a language for terminal prompts? (e.g. keep all CLI outputs in white color regardless of the theme used)

@pomber
Copy link
Contributor

pomber commented Apr 17, 2023

It should work twice in the same line. Here for example.

Does code hike have a language for terminal prompts? (e.g. keep all CLI outputs in white color regardless of the theme used)

Nope, but I want to add something eventually. If you have ideas you can share them in this issue: #206.

@lavr001
Copy link
Author

lavr001 commented Apr 18, 2023

In regards to the withClass annotation, what I meant was is it possible to use it to apply styles to different lines, instead of columns (e.g. similar to mark=4,15).

For example if I have 20 lines of code in one step, and would like to apply a specific style to lines 2, 6, 12, is there a way to do it in one line (withClass=2,6,12)?

@pomber
Copy link
Contributor

pomber commented Apr 18, 2023

Yes. The syntax is like this:

```python hello.py
print("This is Code Hike")
# withClass(1:2,4) red
print("This is Code Hike")
print("This is Code Hike")
print("This is Code Hike")
print("This is Code Hike")
print("This is Code Hike")
```

@lavr001
Copy link
Author

lavr001 commented Apr 18, 2023

I tried this:
js focus=1:2 mark=1
// withClass(1) bold

and got the error: 'Error: Code Hike can't handle two annotations for the same line', see attached
Screenshot 2023-04-18 at 12 35 01 PM

@pomber
Copy link
Contributor

pomber commented Apr 18, 2023

Can you try it in the playground and share the link?

@lavr001
Copy link
Author

lavr001 commented Apr 18, 2023

Here is the playground link.

I made it work with applying styling to columns using square brackets, but just wondering if there is a cleaner solution with applying custom styling to line(s)

@lavr001
Copy link
Author

lavr001 commented Apr 18, 2023

Thank you! That's exactly what I was looking for.

@pomber pomber closed this as completed Apr 19, 2023
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

No branches or pull requests

2 participants