atom / language-gfm

GitHub Flavored Markdown in Atom
MIT License
101 stars 107 forks source link

Non italics text treated as italics #198

Open knzudgt opened 7 years ago

knzudgt commented 7 years ago

Prerequisites

Description

language-gfm starts rendering in italics and pink colour a text following an underline, without waiting for the closing underline, not considering that the closing underline can never happen.

Steps to Reproduce

  1. Open attached file and change its extension from txt to md
  2. See how text is rendered in the editor following markdown rules from start to line 35
  3. See what happens at line 36: the test suddenly turns pink and stays pink until the end of the document, because of the first underline in _search_form.html.erb

Expected behavior: [What you expect to happen]

language-gfm should wait for the closing underline before formatting text in italics. In markdown italics is rendered by enclosing text inside two underscores and there should be a space before and after the formatted text. An underscore does not automatically mean the user wants to write in italics. In Ruby on Rails the underscore is used as a start to name partials.

Actual behavior: [What actually happens] language-gfm starts formatting text in italics and pink as soon as an underscore is typed. This can result in pages of wrongly formatted text.

Reproduces how often: [What percentage of the time does it reproduce?] Always

Versions

Atom : 1.15.0 Electron: 1.3.13 Chrome : 52.0.2743.82 Node : 6.5.0

apm 1.15.3 npm 3.10.5 node 4.4.5 x64 python 2.7.6 git 2.11.0

OS: Ubuntu 14.04 LTS

Additional Information

The package Markdown preview and GitHub do not experience the same issue. See for instance how the following line is correctly treated.

_search_form.html.erb. _search_form.html.erb. _search_form.html.erb extract.txt