Added paragraph, image and link detection to porcess_md function. Refactored code a bit

This commit is contained in:
2020-07-04 14:10:16 +05:00
parent 06ff0761fc
commit 4c61d24352
8 changed files with 388 additions and 228 deletions

View File

@ -64,5 +64,25 @@ char *to_lower(char *str)
for (char *p = str; *p != '\0'; p++)
*p = tolower(*p);
return str;
}
/**
* @brief Remove unneded spaces at the begining and ending of string
*
* @param str
* @return char*
*/
char *trim(char *str)
{
while (str[0] == ' ' || str[0] == '\n' || str[0] == '\t')
{
memmove(str, str + 1, strlen(str));
}
while (str[strlen(str) - 1] == ' ' || str[strlen(str) - 1] == '\n' || str[strlen(str) - 1] == '\t')
{
str[strlen(str) - 1] = '\0';
}
return str;
}