Y
Y
Yoshinon Eared2017-05-07 18:43:41
JavaScript
Yoshinon Eared, 2017-05-07 18:43:41

How to clean up markdown for parsing?

Never worked with them. I read about them, I try to do something there, but in the end nothing happens anyway. Or it works, but not quite the same. Experience and skills are lacking.
I think many people are familiar with such a thing as markdown, which allows you to format text according to certain rules using specials. characters *, #, ~ or HTML tags like or etc. So. There is one software called "Simplenote" that allows you to take notes and it is almost perfect for me. But it has a small problem. The fact is that the program takes the first line from the note as the title, including all these specials. symbols. Those. if I want to center one of the lines, then in the note title I will see all the tags at once. The picture is an example of such a miracle.<H1></H1><P>
6e23c80ae7d64aacb7d2d7a9000da3ff.png
Digging through the sources, I found a line with a regular expression that parses the first line of a note:

const noteTitleAndPreviewRegExp = /(\S[^\n]*)\s*(\S[^\n]*)?/;

I tried to change something there, without understanding what, and in the end I did not achieve a result.
I don’t ask you to do it for me, I’m still trying to figure it out further, but I ask you to tell me where to dig and in which direction - if before removing the special. characters I can still finish in one evening, then to a group of HTML tags with is unlikely. <ТЕГ> текст </ТЕГ>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dark Hole, 2017-05-07
@Aquinary

Having corrected that regular expression, it is possible to force it to take only the characters we need, but it comes out painfully crooked-eyed. Therefore, after receiving (can be chained), you need to replay the received string - this is the beauty of regexr.com/3ftge.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question