code-hike / codehike

Marvellous code walkthroughs
https://codehike.org
MIT License
4.39k stars 135 forks source link

Comments in code is considered as focus #367

Open loicsay opened 1 year ago

loicsay commented 1 year ago

Hi @pomber and thanks for this awesome work!

I'm facing an issue but not sure if it's a bug or if I'm not using it the right way. The following .mdx triggers this error: error running remarkCodeHike FocusNumberError: Invalid number "" in focus string

```js
export const sorts = [
//   {
//     label: 'My label',
//     value: 'my_value',
//   }
];

It looks like the comments in the code are considered as a focus comment syntax by Code Hike 🤔 Is it a bug or something expected? Moreover, I'm using contentlayer on top of it but I'm not sure this is related.

Thanks!

pomber commented 1 year ago

Oh, that's because Code Hike has a label annotation, and it's interpreting // label: 'My label', as an annotation.

Two things we need to improve:

loicsay commented 1 year ago

Thanks for the clarification!