Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Markdown table issues #11

Open
palkan opened this issue Sep 17, 2019 · 1 comment
Open

Markdown table issues #11

palkan opened this issue Sep 17, 2019 · 1 comment
Labels
bug Something isn't working

Comments

@palkan
Copy link

palkan commented Sep 17, 2019

Given the following test.md file:

# Some table

This is table:

| Feature       | One        | Two |
| ------------- |-------------| -----|
| Scalability doesn't exist      | yes  | yes  |
| Flexibility rules    | no       |   yes  |
| Something else | no       |   yes  |

I have the following output:

$ forspell test.md

test.md:1: table't (suggestions: tablet, table's, tableau)                                                                                               
test.md:0: elsenoyes (suggestions: elsewhere, Elsinore, noyesload)                                                                                       
Progress: |=============================================================================================================================================|
Forspell inspects *.rb, *.c, *.cpp, *.md files                                                                                                           
1 file inspected, 2 errors detected

P.S. Thanks for the project! 🙂

@kkuprikov
Copy link
Owner

kkuprikov commented Sep 17, 2019

Hi @palkan !
Thanks for feedback!

Indeed, there is a problem with table parsing.
Here's the parsed table you provided.
Markdown parser does not provide correct location value in child elements. Therefore, input for spellchecking is forming incorrectly.

{:type=>:root,
 :location=>1,
 :children=>
  [{:type=>:header, :attr=>{"id"=>"some-table"}, :location=>1, :children=>[{:type=>:text, :value=>"Some table", :location=>1}]},
   nil,
   {:type=>:p, :location=>3, :children=>[{:type=>:text, :value=>"This is table:", :location=>3}]},
   nil,
   {:type=>:table,
    :location=>5,
    :children=>
     [{:type=>:thead,
       :location=>nil,
       :children=>
        [{:type=>:tr,
          :location=>nil,
          :children=>
           [{:type=>:td, :location=>nil, :children=>[{:type=>:text, :value=>"Feature", :location=>nil}]},
            {:type=>:td, :location=>nil, :children=>[{:type=>:text, :value=>"One", :location=>nil}]},
            {:type=>:td, :location=>nil, :children=>[{:type=>:text, :value=>"Two", :location=>nil}]}]}]},
      {:type=>:tbody,
       :location=>nil,
       :children=>
        [{:type=>:tr,
          :location=>nil,
          :children=>
           [{:type=>:td,
             :location=>nil,
             :children=>
              [{:type=>:text, :value=>"Scalability doesn", :location=>nil},
               {:type=>:smart_quote, :value=>:rsquo, :location=>1},
               {:type=>:text, :value=>"t exist", :location=>1}]},
            {:type=>:td, :location=>nil, :children=>[{:type=>:text, :value=>"yes", :location=>nil}]},
            {:type=>:td, :location=>nil, :children=>[{:type=>:text, :value=>"yes", :location=>nil}]}]},
         {:type=>:tr,
          :location=>nil,
          :children=>
           [{:type=>:td, :location=>nil, :children=>[{:type=>:text, :value=>"Flexibility rules", :location=>nil}]},
            {:type=>:td, :location=>nil, :children=>[{:type=>:text, :value=>"no", :location=>nil}]},
            {:type=>:td, :location=>nil, :children=>[{:type=>:text, :value=>"yes", :location=>nil}]}]},
         {:type=>:tr,
          :location=>nil,
          :children=>
           [{:type=>:td, :location=>nil, :children=>[{:type=>:text, :value=>"Something else", :location=>nil}]},
            {:type=>:td, :location=>nil, :children=>[{:type=>:text, :value=>"no", :location=>nil}]},
            {:type=>:td, :location=>nil, :children=>[{:type=>:text, :value=>"yes", :location=>nil}]}]}]}]}]}

@kkuprikov kkuprikov added the bug Something isn't working label Sep 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants