Repository: rasahq/rasa
Issue: StoryMarkdownToYamlConverter fails to convert entity annotation in e2e story

**Rasa version**: 2.0.0rc3

**Rasa SDK version** (if used & relevant):

**Rasa X version** (if used & relevant):

**Python version**: 3.7.9

**Operating system** (windows, osx, ...): OSX

**Issue**:
When converting this e2e markdown story into yaml:
```markdown
## story_id
* enter_data: [two]{"entity": "number", "value": 2} plus [two]{"entity": "number", "value": 2}
```
the entities get muffled and I end up with:
```yaml
version: "2.0"
stories:
- story: story_id
  steps:
  - intent: 'enter_data: [two]'
```



**Error (including full traceback)**:
```
/Users/sams/rasa/rasa/shared/utils/io.py:87: UserWarning: Failed to parse arguments in line 'enter_data: [two]{"entity": "number", "value": 2} plus [two]{"entity": "number", "value": 2}'. Failed to decode parameters as a json object. Make sure the intent is followed by a proper json object. Error: Extra data: line 1 column 34 (char 33)
```

**Command or request that led to error**:
```python
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
result = loop.run_until_complete(StoryMarkdownToYamlConverter.convert_and_write(Path("tmp_stories.md"), Path(".")))
```

**Content of configuration file (config.yml)** (if relevant):
```yml

```

**Content of domain file (domain.yml)** (if relevant):
```yml

```


Changed files:
rasa/shared/core/training_data/story_reader/story_step_builder.py, tests/core/training/converters/test_story_markdown_to_yaml_converter.py, rasa/shared/core/training_data/story_reader/markdown_story_reader.py, rasa/shared/core/training_data/story_reader/yaml_story_reader.py, rasa/core/training/converters/story_markdown_to_yaml_converter.py, tests/shared/core/training_data/story_writer/test_yaml_story_writer.py, rasa/shared/core/training_data/story_reader/story_reader.py

diff --git a/rasa/core/training/converters/story_markdown_to_yaml_converter.py b/rasa/core/training/converters/story_markdown_to_yaml_converter.py
index f6ae2f34b98..209744f065a 100644
--- a/rasa/core/training/converters/story_markdown_to_yaml_converter.py
+++ b/rasa/core/training/converters/story_markdown_to_yaml_converter.py
@@ -41,12 +41,12 @@ class StoryMarkdownToYamlConverter(TrainingDataConverter):
 
         # check if source file is test stories file
         if MarkdownStoryReader.is_test_stories_file(source_path):
-            reader = MarkdownStoryReader(unfold_or_utterances=False, use_e2e=True)
+            reader = MarkdownStoryReader(is_used_for_conversion=True, use_e2e=True)
             output_core_path = cls._generate_path_for_converted_test_data_file(
                 source_path, output_path
             )
         else:
-            reader = MarkdownStoryReader(unfold_or_utterances=False)
+            reader = MarkdownStoryReader(is_used_for_conversion=True)
             output_core_path = cls.generate_path_for_converted_training_data_file(
                 source_path, output_path
             )
diff --git a/rasa/shared/core/training_data/story_reader/markdown_story_reader.py b/rasa/shared/core/training_data/story_reader/markdown_story_reader.py
index 6c2c2bf9638..0dc2e5e05b5 100644
--- a/rasa/shared/core/training_data/story_reader/markdown_story_reader.py
+++ b/rasa/shared/core/training_data/story_reader/markdown_story_reader.py
@@ -186,7 +186,7 @@ class MarkdownStoryReader(StoryReader):
             )
         parsed_messages = [self._parse_message(m, line_num) for m in messages]
         self.current_step_builder.add_user_messages(
-            parsed_messages, self.unfold_or_utterances
+            parsed_messages, self.is_used_for_conversion
         )
 
     def _add_e2e_messages(self, e2e_messages: List[Text], line_num: int) -> None:
@@ -204,7 +204,7 @@ class MarkdownStoryReader(StoryReader):
         self.current_step_builder.add_user_messages(parsed_messages)
 
     @staticmethod
-    def parse_e2e_message(line: Text) -> Message:
+    def parse_e2e_message(line: Text, is_used_for_conversion: bool = False) -> Message:
         """Parses an md list item line based on the current section type.
 
         Matches expressions of the form `<intent>:<example>`. For the
@@ -231,6 +231,11 @@ class MarkdownStoryReader(StoryReader):
         intent = match.group(2)
         message = match.group(4)
         example = entities_parser.parse_training_example(message, intent)
+        if is_used_for_conversion:
+            # In case this is a simple conversion from Markdown we should copy over
+            # the original text and not parse the entities
+            example.data[rasa.shared.nlu.constants.TEXT] = message
+            example.data[rasa.shared.nlu.constants.ENTITIES] = []
 
         # If the message starts with the `INTENT_MESSAGE_PREFIX` potential entities
         # are annotated in the json format (e.g. `/greet{"name": "Rasa"})
@@ -243,7 +248,7 @@ class MarkdownStoryReader(StoryReader):
     def _parse_message(self, message: Text, line_num: int) -> UserUttered:
 
         if self.use_e2e:
-            parsed = self.parse_e2e_message(message)
+            parsed = self.parse_e2e_message(message, self.is_used_for_conversion)
             text = parsed.get("text")
             intent = {INTENT_NAME_KEY: parsed.get("intent")}
             entities = parsed.get("entities")
diff --git a/rasa/shared/core/training_data/story_reader/story_reader.py b/rasa/shared/core/training_data/story_reader/story_reader.py
index eb3f461200d..ebdb69fb211 100644
--- a/rasa/shared/core/training_data/story_reader/story_reader.py
+++ b/rasa/shared/core/training_data/story_reader/story_reader.py
@@ -28,7 +28,7 @@ class StoryReader:
         template_vars: Optional[Dict] = None,
         use_e2e: bool = False,
         source_name: Text = None,
-        unfold_or_utterances: bool = True,
+        is_used_for_conversion: bool = False,
     ) -> None:
         """Constructor for the StoryReader.
 
@@ -37,11 +37,12 @@ class StoryReader:
             template_vars: Template variables to be replaced.
             use_e2e: Specifies whether to use the e2e parser or not.
             source_name: Name of the training data source.
-            unfold_or_utterances: Identifies if the user utterance is a part of
-              OR statement. This parameter is used only to simplify the conversation
-              from MD story files. Don't use it other ways, because it ends up
-              in a invalid story that cannot be user for real training.
-              Default value is `True`, which preserves the expected behavior
+            is_used_for_conversion: Identifies if the user utterances should be parsed
+              (entities are extracted and removed from the original text) and
+              OR statements should be unfolded . This parameter is used only to
+              simplify the conversation from MD story files. Don't use it other ways,
+              because it ends up in a invalid story that cannot be user for real
+              training. Default value is `False`, which preserves the expected behavior
               of the reader.
         """
         self.story_steps = []
@@ -50,7 +51,7 @@ class StoryReader:
         self.template_variables = template_vars if template_vars else {}
         self.use_e2e = use_e2e
         self.source_name = source_name
-        self.unfold_or_utterances = unfold_or_utterances
+        self.is_used_for_conversion = is_used_for_conversion
         self._is_parsing_conditions = False
 
     def read_from_file(self, filename: Text) -> List[StoryStep]:
diff --git a/rasa/shared/core/training_data/story_reader/story_step_builder.py b/rasa/shared/core/training_data/story_reader/story_step_builder.py
index a88b4a4ee44..7ac41848360 100644
--- a/rasa/shared/core/training_data/story_reader/story_step_builder.py
+++ b/rasa/shared/core/training_data/story_reader/story_step_builder.py
@@ -59,17 +59,17 @@ class StoryStepBuilder:
             return [Checkpoint(name) for name in end_names]
 
     def add_user_messages(
-        self, messages: List[UserUttered], unfold_or_utterances: bool = True
+        self, messages: List[UserUttered], is_used_for_conversion: bool = False
     ) -> None:
         """Adds next story steps with the user's utterances.
 
         Args:
             messages: User utterances.
-            unfold_or_utterances: Identifies if the user utterance is a part of
+            is_used_for_conversion: Identifies if the user utterance is a part of
               OR statement. This parameter is used only to simplify the conversation
               from MD story files. Don't use it other ways, because it ends up
               in a invalid story that cannot be user for real training.
-              Default value is `True`, which preserves the expected behavior
+              Default value is `False`, which preserves the expected behavior
               of the reader.
         """
         self.ensure_current_steps()
@@ -80,7 +80,7 @@ class StoryStepBuilder:
                 t.add_user_message(messages[0])
         else:
             # this simplifies conversion between formats, but breaks the logic
-            if not unfold_or_utterances:
+            if is_used_for_conversion:
                 for t in self.current_steps:
                     t.add_events(messages)
                 return
diff --git a/rasa/shared/core/training_data/story_reader/yaml_story_reader.py b/rasa/shared/core/training_data/story_reader/yaml_story_reader.py
index d6d621b36bd..76d30894f0e 100644
--- a/rasa/shared/core/training_data/story_reader/yaml_story_reader.py
+++ b/rasa/shared/core/training_data/story_reader/yaml_story_reader.py
@@ -67,7 +67,7 @@ class YAMLStoryReader(StoryReader):
             reader.template_variables,
             reader.use_e2e,
             reader.source_name,
-            reader.unfold_or_utterances,
+            reader.is_used_for_conversion,
         )
 
     def read_from_file(self, filename: Union[Text, Path]) -> List[StoryStep]:
diff --git a/tests/core/training/converters/test_story_markdown_to_yaml_converter.py b/tests/core/training/converters/test_story_markdown_to_yaml_converter.py
index 3f804e07b34..d0d8097f4d2 100644
--- a/tests/core/training/converters/test_story_markdown_to_yaml_converter.py
+++ b/tests/core/training/converters/test_story_markdown_to_yaml_converter.py
@@ -110,9 +110,7 @@ async def test_test_stories(tmpdir: Path):
             "  steps:\\n"
             "  - intent: faq\\n"
             "    user: |-\\n"
-            "      what is Rasa X?\\n"
-            "    entities:\\n"
-            "    - product: Rasa X\\n"
+            "      what is [Rasa X](product)?\\n"
             "  - slot_was_set:\\n"
             "    - product: x\\n"
             "  - action: respond_faq\\n"
diff --git a/tests/shared/core/training_data/story_writer/test_yaml_story_writer.py b/tests/shared/core/training_data/story_writer/test_yaml_story_writer.py
index 9014a4cbd2b..02c21cdc8b2 100644
--- a/tests/shared/core/training_data/story_writer/test_yaml_story_writer.py
+++ b/tests/shared/core/training_data/story_writer/test_yaml_story_writer.py
@@ -34,7 +34,7 @@ async def test_simple_story(
 ):
 
     original_md_reader = MarkdownStoryReader(
-        default_domain, None, False, input_md_file, unfold_or_utterances=False
+        default_domain, None, False, input_md_file, is_used_for_conversion=True
     )
     original_md_story_steps = original_md_reader.read_from_file(input_md_file)
 
@@ -63,7 +63,7 @@ async def test_story_start_checkpoint_is_skipped(default_domain: Domain):
     input_md_file = "data/test_stories/stories.md"
 
     original_md_reader = MarkdownStoryReader(
-        default_domain, None, False, input_md_file, unfold_or_utterances=False
+        default_domain, None, False, input_md_file, is_used_for_conversion=True
     )
     original_md_story_steps = original_md_reader.read_from_file(input_md_file)
 
@@ -74,7 +74,7 @@ async def test_story_start_checkpoint_is_skipped(default_domain: Domain):
 
 async def test_forms_are_converted(default_domain: Domain):
     original_md_reader = MarkdownStoryReader(
-        default_domain, None, False, unfold_or_utterances=False
+        default_domain, None, False, is_used_for_conversion=True
     )
     original_md_story_steps = original_md_reader.read_from_file(
         "data/test_stories/stories_form.md"