Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion include/markdown.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@ enum line_bitmask {
IS_H1_ATX,
IS_H2,
IS_H2_ATX,
IS_H3,
IS_H3_ATX,
IS_H4,
IS_H4_ATX,
IS_H5,
IS_H5_ATX,
IS_H6,
IS_H6_ATX,
IS_QUOTE,
IS_CODE,
IS_TILDE_CODE,
Expand Down Expand Up @@ -92,4 +100,4 @@ deck_t *new_deck();
void free_line(line_t *l);
void free_deck(deck_t *);

#endif // !defined( MARKDOWN_H )
#endif // !defined( MARKDOWN_H )
33 changes: 33 additions & 0 deletions issue_169_test.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# H1 Work

This should work fine.

---

## H2 work

This should also work fine.

---

### H3 (dont work or not implemented)

This should now work with our fix!

---

#### H4 (dont work or not implemented)

This should also now work with our fix!

---

##### H5 (dont work or not implemented)

This should also now work with our fix!

---

###### H6 (dont work or not implemented)

This should also now work with our fix!
11 changes: 4 additions & 7 deletions src/viewer.c
Original file line number Diff line number Diff line change
Expand Up @@ -730,14 +730,11 @@ void inline_display(WINDOW *window, const wchar_t *c, const int colors, int noco
// opening special char
} else {

// emphasis or code span can start after new-line or space only
// and of cause after another emphasis markup
//TODO this condition looks ugly
if(i == c ||
// emphasis or code span can start after whitespace, emphasis markup, or at start of line
// also allow after escaped characters
if(i == c || *i == L'\\' ||
iswspace(*(i - 1)) ||
((iswspace(*(i - 1)) || *(i - 1) == L'*' || *(i - 1) == L'_') &&
((i - 1) == c || iswspace(*(i - 2)))) ||
*i == L'\\') {
*(i - 1) == L'*' || *(i - 1) == L'_') {

// url in pandoc style
if ((*i == L'[') || (*i == L'!' && *(i + 1) && *(i + 1) == L'[')) {
Expand Down
46 changes: 46 additions & 0 deletions test_headers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# H1 Header Test

This is a test of H1 header.

---

## H2 Header Test

This is a test of H2 header.

---

### H3 Header Test

This is a test of H3 header.

---

#### H4 Header Test

This is a test of H4 header.

---

##### H5 Header Test

This is a test of H5 header.

---

###### H6 Header Test

This is a test of H6 header.

---

# Summary

All header levels should now be supported:

* H1 - Blue underlined
* H2 - Blue bold
* H3 - Blue dim
* H4 - Blue standout
* H5 - Blue reverse
* H6 - Blue italic