aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremias Stotter <jeremias@stotter.eu>2021-12-28 20:45:23 +0100
committerJeremias Stotter <jeremias@stotter.eu>2021-12-28 20:45:23 +0100
commit098d68661c6be286b41245927e8ab2f7806419ad (patch)
tree00a11a01a4ba410895d0cc9784e8352b1443ee6c
parent4c3bb4528c1583ae397c56397c4d46660d67a935 (diff)
downloadJBlog-098d68661c6be286b41245927e8ab2f7806419ad.tar.gz
JBlog-098d68661c6be286b41245927e8ab2f7806419ad.tar.bz2
JBlog-098d68661c6be286b41245927e8ab2f7806419ad.zip
Unused - and = now get displayed
-rw-r--r--md.c36
1 files changed, 28 insertions, 8 deletions
diff --git a/md.c b/md.c
index 6b26b8d..b38c35d 100644
--- a/md.c
+++ b/md.c
@@ -269,16 +269,26 @@ int parse_markdown(char* input, char* buffer, size_t buffer_size) {
if(dash_chain >= 1) {
active_element = root;
// Make the last element a title unless
- if(dash_chain >= 3 && active_element == root && !newline) {
- struct tree_element* hr = new_child(root, -1);
- hr->type = t_hr;
- hr->allow_inner = false;
+ if(!newline) {
+ if(dash_chain >= 3 && active_element == root) {
+ struct tree_element* hr = new_child(root, -1);
+ hr->type = t_hr;
+ hr->allow_inner = false;
+ } else {
+ for(int i = 0; i < dash_chain; i++)
+ append_char_to_active(root, &active_element, '-');
+ }
} else {
LAST_TO_TITLE(2);
}
}
- if(eq_chain >= 1 && newline) {
- LAST_TO_TITLE(1);
+ if(eq_chain >= 1) {
+ if(newline) {
+ LAST_TO_TITLE(1);
+ } else {
+ for(int i = 0; i < eq_chain; i++)
+ append_char_to_active(root, &active_element, '=');
+ }
}
eq_chain = 0;
@@ -409,12 +419,22 @@ int parse_markdown(char* input, char* buffer, size_t buffer_size) {
append_char_to_active(root, &active_element, '#');
hash_chain = 0;
}
+ if(dash_chain > 0) {
+ for(int i = 0; i < dash_chain; i++)
+ append_char_to_active(root, &active_element, '-');
+ dash_chain = 0;
+ }
+ if(eq_chain > 0) {
+ for(int i = 0; i < eq_chain; i++)
+ append_char_to_active(root, &active_element, '=');
+ eq_chain = 0;
+ }
+
if(newline && root_on_newline) {
active_element = root;
root_on_newline = false;
}
- dash_chain = 0;
- eq_chain = 0;
+
newline = false;
list_waiting = false;
append_char_to_active(root, &active_element, *cur_char);
Jeremias Stotters git repositories generated by CGIT