Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for markdown text #7

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

kaozdl
Copy link
Contributor

@kaozdl kaozdl commented Oct 4, 2020

Closes #1
Not every formatting option in markdown counts as a "word".
I took a very naive approach by filtering out only the options that look as a "word".

Copy link
Owner

@iaguirre88 iaguirre88 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really like your approach. However, instead of checking word by word, I think I would have replaced the whole string at once to get rid of every markdown word and then proceed as usual. What do you think?

Maybe shomething like this:

@markdown_words [
  # ignore headers
  "#+",
  "(==)+",
  . . .
]

{:ok, regex} = Regex.compile(Enum.join(@markdown_words, "|"))
new_text = Regex.replace(regex, text, "")

# then proceed as usual

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support markdown syntax
2 participants