ropensci / spelling

Tools for Spell Checking in R
https://docs.ropensci.org/spelling
Other
107 stars 25 forks source link

Links get treated as text in commonmark 1.9.0 #69

Closed jeroen closed 1 year ago

jeroen commented 1 year ago

For example:

cat(commonmark::markdown_xml('A link: https://crandb.r-pkg.org is good', extensions = TRUE, sourcepos = TRUE))

now gives:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE document SYSTEM "CommonMark.dtd">
<document sourcepos="1:1-1:40" xmlns="http://commonmark.org/xml/1.0">
  <paragraph sourcepos="1:1-1:40">
    <text sourcepos="1:1-1:13" xml:space="preserve">A link: </text>
    <link sourcepos="1:8-1:32" destination="https://crandb.r-pkg.org" title="">
      <text sourcepos="1:8-1:32" xml:space="preserve">https://crandb.r-pkg.org</text>
    </link>
    <text sourcepos="1:33-1:40" xml:space="preserve"> is good</text>
  </paragraph>
</document>

Whereas in previous versions of commonmark it would give:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE document SYSTEM "CommonMark.dtd">
<document sourcepos="1:1-1:40" xmlns="http://commonmark.org/xml/1.0">
  <paragraph sourcepos="1:1-1:40">
    <text sourcepos="1:1-1:13" xml:space="preserve">A link: </text>
    <link destination="https://crandb.r-pkg.org" title="">
      <text xml:space="preserve">https://crandb.r-pkg.org</text>
    </link>
    <text sourcepos="1:33-1:40" xml:space="preserve"> is good</text>
  </paragraph>
</document>

Note how <link> has gained a sourcepos attribute. I think this is what causes them to be spellchecked.

@gaborcsardi

jeroen commented 1 year ago

Actually this fixes the problem only for markdown vignettes, not Rd files...

jeroen commented 1 year ago

Actually roxygen2 does not enable autolinking, so this never worked in Rd.