serokell/xrefcheck

Refactor anchors case-sensitivity

aeqz opened this issue · 1 comments

aeqz commented

Clarification and motivation

With the solution for #211, Xrefcheck treats anchors as case-sensitive or case-insensitive depending on the configured markdown flavour. However, they are still being represented as Text and we have to take this configuration into account every time that we use them, which can be missed when implementing new features.

A possible solution is to create a wrapper type for anchors and to apply some of the following ideas:

  • Do not allow to compare them unless explicitly taking the configured markdown into account.
  • Make its Eq instance implementation depend on the configured markdown.
  • Allow to extract a canonical (regarding case-sensitivity) Text value from it with a function that depends on the configured markdown, which will be used for comparison-related checks.

Acceptance criteria

  • Having explored the proposed ideas or proposed a new one.
  • Having implemented one of them in order to make the anchors case-sensitivity feature easier to manage and more maintainable.

#249 and #243 PR seem to be related; they are about filepaths in Reference type, but effectively suggest a similar thing.

We will have to keep that in mind, and avoid working on any two tasks of these in parallel.