summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVicent Marti <tanoku@gmail.com>2012-10-11 13:25:03 +0200
committerVicent Marti <tanoku@gmail.com>2012-10-11 13:25:03 +0200
commit0e7d0cc653874fef49a3ef25c01bc2ccd726c9bf (patch)
tree7ae24506982eeb66826dd8558a68e28d6cabbab3
parent2bb12820b13f3a71342f5a911e1d1a7667105506 (diff)
downloadsundown-myr-0e7d0cc653874fef49a3ef25c01bc2ccd726c9bf.tar.gz
Better NO_INTRA_EMPHASIS logic
-rw-r--r--src/markdown.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/markdown.c b/src/markdown.c
index a441cb8..3253b0f 100644
--- a/src/markdown.c
+++ b/src/markdown.c
@@ -501,7 +501,7 @@ parse_emph1(struct buf *ob, struct sd_markdown *rndr, uint8_t *data, size_t size
if (data[i] == c && !_isspace(data[i - 1])) {
if (rndr->ext_flags & MKDEXT_NO_INTRA_EMPHASIS) {
- if (!(i + 1 == size || _isspace(data[i + 1]) || ispunct(data[i + 1])))
+ if (i + i < size && isalnum(data[i + 1]))
continue;
}
@@ -596,6 +596,11 @@ char_emphasis(struct buf *ob, struct sd_markdown *rndr, uint8_t *data, size_t of
uint8_t c = data[0];
size_t ret;
+ if (rndr->ext_flags & MKDEXT_NO_INTRA_EMPHASIS) {
+ if (offset > 0 && !_isspace(data[-1]) && data[-1] != '>')
+ return 0;
+ }
+
if (size > 2 && data[1] != c) {
/* whitespace cannot follow an opening emphasis;
* strikethrough only takes two characters '~~' */