Automattic / Automattic/harper
Exlude strings beginning with '@' (citations in pandoc-markdown) from being spelling errors in Markdown
- Dominant language
- Rust
- Stars
- 15.4k
- Forks
- 627
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 102
Description
**What problem does this solve?**
There is (relatively) standard syntax in (pandoc) Markdown for citations:
_To cite a bibliographic item with an identifier citationkey, use the syntax '@citationkey' Normal citations should be included in square brackets, with semicolons separating distinct items:
Blah blah [@example99; @example2003; @example2004]._
See: https://pandoc.org/MANUAL.html#citation-syntax
The issue is that the current Markdown implementation---at least as far as I can tell---regards basically any string consisting of '@citationkey' as a spelling error.
Strictly speaking, the issue is with the 'foo' part. The spell checker does not generally have the string 'foo' in its dictionary since 'foo' is usually a proper name. But the '@' serves as a clear indicator that anything in a string beginning with it can be ignored from the perspective of a spellchecker (at least in Markdown). So 'foo' (even if it's not in the dictionary) shouldn't be a spelling error when it's part of a string beginning with '@'.
Note that I'm new to Harper, so if this is somehow a solved problem in a way that I don't realize, please let me know.
**Proposed Solution**
In Markdown, when you have a string beginning with '@', such as '@citationkey', prevent any part of that string from being labelled as a spelling error. Thus, in a string such as such as '@citationkey2002', prevent 'citationkey2002' from being marked as a spelling error even though 'citationkey2002' is not in the dictionary.
Since such strings are intended as references---or at least not intended as correct spellings of English words---I can't see any harm from excluding any string beginning with '@' from spell checking in Markdown.
I would hope that this is relatively easy to implement. Perhaps not many people use neovim for academic writing, but it would be very useful to those of us who do.
There are some slight complications, as a citation can also begin e.g. '-@' in Markdown, but it should be relatively straightforward.
**Examples**
In the follow examples, 'Johnston2001' and 'Johnston2002' are liable to be treated as spelling errors currently:
@Johnston2001
[@Johnston2001]
[@Johnston2001; @Johnston2002]
[-@Johnston2001]
**Component**
- [ ] Core engine
- [x ] Plugin/Extension
- [ ] Other: _____
**Additional Context**
Any other relevant info.
Contributor guide
Research direction
No file or test is named in the issue. Start by locating Harper's Markdown implementation and reproduce the listed citation examples, then find the existing spelling-error tests. Done means citation keys beginning with '@' (including bracketed, semicolon-separated, and '-@' examples) are not reported as spelling errors in Markdown.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- markdown
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100