Skip to content
Browse files

Corrected PHP Markdown Extra emphasis handling.

  • Loading branch information...
1 parent 071cf4a commit 8b6da4cea2887870719a4fb7bd840bacc11346a6 @michelf committed Oct 10, 2009
Showing with 9 additions and 9 deletions.
  1. +9 −9 markdown.php
View
18 markdown.php
@@ -2588,19 +2588,19 @@ function _doFencedCodeBlocks_newlines($matches) {
# work in the middle of a word.
#
var $em_relist = array(
- '' => '(?:(?<!\*)\*(?!\*)|(?<![a-zA-Z0-9_])_(?!_))(?=\S)(?![.,:;]\s)',
- '*' => '(?<=\S)(?<!\*)\*(?!\*)',
- '_' => '(?<=\S)(?<!_)_(?![a-zA-Z0-9_])',
+ '' => '(?:(?<!\*)\*(?!\*)|(?<![a-zA-Z0-9_])_(?!_))(?=\S|$)(?![.,:;]\s)',
+ '*' => '(?<=\S|^)(?<!\*)\*(?!\*)',
+ '_' => '(?<=\S|^)(?<!_)_(?![a-zA-Z0-9_])',
);
var $strong_relist = array(
- '' => '(?:(?<!\*)\*\*(?!\*)|(?<![a-zA-Z0-9_])__(?!_))(?=\S)(?![.,:;]\s)',
- '**' => '(?<=\S)(?<!\*)\*\*(?!\*)',
- '__' => '(?<=\S)(?<!_)__(?![a-zA-Z0-9_])',
+ '' => '(?:(?<!\*)\*\*(?!\*)|(?<![a-zA-Z0-9_])__(?!_))(?=\S|$)(?![.,:;]\s)',
+ '**' => '(?<=\S|^)(?<!\*)\*\*(?!\*)',
+ '__' => '(?<=\S|^)(?<!_)__(?![a-zA-Z0-9_])',
);
var $em_strong_relist = array(
- '' => '(?:(?<!\*)\*\*\*(?!\*)|(?<![a-zA-Z0-9_])___(?!_))(?=\S)(?![.,:;]\s)',
- '***' => '(?<=\S)(?<!\*)\*\*\*(?!\*)',
- '___' => '(?<=\S)(?<!_)___(?![a-zA-Z0-9_])',
+ '' => '(?:(?<!\*)\*\*\*(?!\*)|(?<![a-zA-Z0-9_])___(?!_))(?=\S|$)(?![.,:;]\s)',
+ '***' => '(?<=\S|^)(?<!\*)\*\*\*(?!\*)',
+ '___' => '(?<=\S|^)(?<!_)___(?![a-zA-Z0-9_])',
);

0 comments on commit 8b6da4c

Please sign in to comment.
Something went wrong with that request. Please try again.