# Preformatted text should show what I pasted

**URL:** https://meta.discourse.org/t/preformatted-text-should-show-what-i-pasted/39806
**Category:** Bug
**Tags:** markdown-it-review
**Created:** [2016 年 2 月 18 日午後 3:57 UTC](https://meta.discourse.org/t/preformatted-text-should-show-what-i-pasted/39806 "2016-02-18T15:57:22Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![tito](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tito/32/108845_2.png) [@tito](https://meta.discourse.org/u/tito)
#### Post date: [2016 年 2 月 18 日午後 3:57 UTC](https://meta.discourse.org/t/preformatted-text-should-show-what-i-pasted/39806/1 "2016-02-18T15:57:22Z")

</div>

this is original text [https://dl.dropboxusercontent.com/u/9303546/SublimeText/bugs/SpacesToTabs.py](https://dl.dropboxusercontent.com/u/9303546/SublimeText/bugs/SpacesToTabs.py)

this is what this forums shows:

```python
import re, sublime, sublime_plugin

class SpaceToTabsListener(sublime_plugin.EventListener):
	def on_post_text_command(self, view, command_name, args):
		if command_name == 'insert' and args['characters'] == '\n' and not view.settings().get('translate_tabs_to_spaces'):
			view.run_command('unexpand_tabs', {"set_translate_tabs":True})
			view.run_command('space_to_tabs')

class SpaceToTabsCommand(sublime_plugin.TextCommand):
	def run(self, edit):
		view = self.view
		for region in reversed(view.sel()):
			indentation = sublime.Region(view.line(region).begin(), region.end())
			content = view.substr(indentation)
			if re.search('^\t+ +', content):
				view.replace(edit, indentation, re.sub('^(\t+)( +)', '\\1\t', content))

```

---

<div class="post-metadata">

### Author: ![gerhard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gerhard/32/119479_2.png) [@gerhard](https://meta.discourse.org/u/gerhard)
#### Post date: [2016 年 2 月 18 日午後 4:52 UTC](https://meta.discourse.org/t/preformatted-text-should-show-what-i-pasted/39806/2 "2016-02-18T16:52:03Z")

</div>

Here’s the diff of the raw text and the rendered code:

 ![](https://global.discourse-cdn.com/meta/original/3X/e/7/e7cdce41e87ebc1835bb811576d6bb6dd4f0680d.png)

And here’s the part that’s different:  
 ![](https://global.discourse-cdn.com/meta/original/3X/e/3/e341a4260b3deee0d211d621d0c4188098e6ecad.png) is shown as `'\\1\t'`

It works with [markdown-it](https://markdown-it.github.io/).

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2017 年 6 月 26 日午後 7:53 UTC](https://meta.discourse.org/t/preformatted-text-should-show-what-i-pasted/39806/3 "2017-06-26T19:53:14Z")

</div>

Fixed per:

> [@CommonMark testing started here!](https://meta.discourse.org/t/commonmark-testing-started-here/65121):
>
> Per our [migration plans](https://meta.discourse.org/t/discourse-commonmark-migration-plans-confetti-ball-balloon), I just enabled [markdown.it](https://github.com/markdown-it/markdown-it) at Meta. It is an excellent [CommonMark](http://commonmark.org/) compliant engine. I expect quite a few edges to be found during this period of testing. Do not open bugs about the new Engine, just reply here. I/we will be updating the top post here with the list of issues and striking out stuff as it is fixed. Current known issues (to be fixed)white_check_mark Onebox vanishes after you start typing and works not-super consistently white_check_mark pending…

Rebaked the OP and all looks good.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2017 年 6 月 26 日午後 7:53 UTC](https://meta.discourse.org/t/preformatted-text-should-show-what-i-pasted/39806/4 "2017-06-26T19:53:18Z")

</div>


