codehike
codehike copied to clipboard
Dynamic code mention
In previous CodeHike, it was possible to do the following:
<CH.Section>
Some text [hover here](focus://code.py#3)
```python code.py
def method():
print("hello")
print("world")
``
</CH.Section>
The current version has the following capability - https://codehike.org/docs/code/code-mentions
BUT it requires hard-coding the hover values in CSS styles. Is there a generic way for this as previous versions supported?
It's possible. The key is in the last paragraph of that page:
If you need a more complex behavior, you could add a React Context Provider to the HoverContainer component and use it to store the current hover state. Then, you can use the useContext hook in the Line component to check if the current line is the one being hovered over.