void () { PsiFile file = myFixture.configureByText("a.md", "at on [First model](url)"); TextContent text = TextExtractor.findTextAt(file, 0, TextContent.TextDomain.ALL); List<Pair<SmartPsiFileRange, String>> replacements = GrazieReplaceTypoQuickFix.toFileReplacements(TextRange.from(text.toString().indexOf("on"), "on First".length()), "the first", text); WriteCommandAction.runWriteCommandAction(getProject(), () -> GrazieReplaceTypoQuickFix.applyReplacements(myFixture.getEditor().getDocument(), replacements)); myFixture.checkResult("at [the first model](url)"); // the result could be different, but the markup should still be preserved }