daviferreira/medium-editor — pull request #100 by arol (2013-11-27 18:59:35+00:00)
Title: Code editing

I added an extra button called `pre`. It allows to format the current block into a piece of code.

## Changes

- Added button on toolbar called pre. Its label is `01011`. It wraps the current paragraph with a `

` which allows you to show pieces of code.
- Tab key is binded only to `pre` blocks so you can indent code while writing code in the editor.

I'm an iOS and backend developer and I don't have expertise on js, so please, feel free to improve my code and be critical with it.

## Nested pre blocks

I found an issue with nested `pre` tags inside another tags. Reproduce with the following steps:

- Write a multiline piece of code and format it as `pre`.
- Select only one line.
- Format it with `pre`

It will create a `span` inside the block. Then you format the same selection as code and it will create a nested block inside the first one.

It's annoying but I found that the same case occurs with `blockquote` and I thought it's a bug of `formatBlock`. Any hints?