code-hike / codehike

Build rich content websites with Markdown and React
https://codehike.org
MIT License
4.68k stars 142 forks source link

Seems to be reading a code comment as a focus string #96

Closed cabljac closed 2 years ago

cabljac commented 2 years ago

I have some mdx:

ButtonBar(children: [
  TextButton(
    onPressed: () =>
      // Navigator.pop(context) would work here, too
      context.goNamed('family', params: {'fid': widget.family.id}),
    child: const Text('Cancel'),
  ),
  ElevatedButton(
    onPressed: () {
      if (_formKey.currentState!.validate()) {
        final person = Person(
          id: 'p${widget.family.people.length + 1}',
          name: _nameController.text,
          age: int.parse(_ageController.text),
        );
        widget.family.people.add(person);
        context.goNamed('person', params: {
          'fid': widget.family.id,
          'pid': person.id,
        });
      }
    },
    child: const Text('Create'),
  ),
]),

codehike seems to be reading line 4 as a focus string when it isn't. I'm getting:

Error: Invalid number "pop(context" in focus string

pomber commented 2 years ago

Yes, I need to fix that. If you need a workaround for now, using /* */ for comments should work.

  TextButton(
    onPressed: () =>
      /* Navigator.pop(context) would work here, too */
      context.goNamed('family', params: {'fid': widget.family.id}),
    child: const Text('Cancel'),
  ),
cabljac commented 2 years ago

thanks!!

github-actions[bot] commented 2 years ago

:rocket: Issue was released in v0.3.0 :rocket: