lukesmurray / markdown-anki-decks

Tool for converting markdown files into anki decks
MIT License
130 stars 12 forks source link

Add option for file extension #18

Open kamalsacranie opened 2 years ago

kamalsacranie commented 2 years ago

Would be useful for file extension specific shortcuts like syntax for \\[...\\] in vim etc.

Edited the cli.py and it worked for me by adding:

@app.command("convert")
def convertMarkdown(
    ...,
    file_extension: str = typer.Option(
        ".md",
        "--extension",
        help="Extension of the text files containing your markdown, e.g. '.md'",
        ),
    ,...
)

And the altering is_correct_filetype():

def is_correct_file_type(file, file_extension: str):
    """Check if a file is a markdown file."""
    # TODO(lukemurray): parameterize markdown extensions?
    if file_extension != ".md":
        return file.endswith(file_extension)
    return file.endswith(".md")

I would go and make a pull request but am in the middle of exams :(

lukesmurray commented 2 years ago

seems completely reasonable. I am also a bit busy at the moment but am open to pull requests and will try to add this functionality once I have some spare time. Glad you are enjoying the project and good luck with exams!

lukesmurray commented 2 years ago

Reopening and will close once the PR is approved and merged.

lukesmurray commented 2 years ago

Now fixed by #21.