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

Markdown filter #558

Merged
merged 6 commits into from
Aug 2, 2019
Merged

Markdown filter #558

merged 6 commits into from
Aug 2, 2019

Conversation

kevina
Copy link
Member

@kevina kevina commented Jul 6, 2019

Todo:

  • Document new filter in manual
  • Rebase to clean up commits
  • Check in test script

Closes #536.

Use aspell --mode=markdown to use.

To see what is being ignored use aspell filter --mode=markdown.

@kevina kevina mentioned this pull request Jul 6, 2019
@kevina
Copy link
Member Author

kevina commented Jul 6, 2019

@RobertHenry6bev @hrabbey @zerok could you test this out and let me know if it works for you.

Please make sure you follow the instructions in the README.md or order to correctly compile from a git checkout. (There is a README also, but that is intended for compiling from a tarball, so please ignore it).

@hrabbey
Copy link

hrabbey commented Jul 7, 2019

Looks good.

Thanks much. It is a helpful improvement, meeting the original request for skipping code blocks / fences, and also URLs, and backtick quoted phrases nicely.

As expected, it does not seem to skip some other features of markdown.
One in particular that shows up for my usage is relative links for images. For example, it would be great to ignore inside ]( ) below the same as a URL:

For a sample file, I used a couple of my own, and
https://raw.githubusercontent.com/tchapi/markdown-cheatsheet/master/README.md
as well as
https://raw.githubusercontent.com/theno/revealjs_template/master/slides.md

I think it is a worthwhile improvement, but I want to emphasize for others that it is only very partially effective. It would not make sense to embed a full parser. Much better to let a user use the markdown parser of their choice, and / or pandoc, to convert to text for elaborate spell checking.
This may be worth mentioning when / if this feature gets documented.

However, for short, simple markdown tags, I think this improvement to aspell will be appreciated by others. It is by me.

@kevina
Copy link
Member Author

kevina commented Jul 7, 2019

it would be great to ignore inside ]( ) below the same as a URL:

That should be doable. (BTW, the URL's are removed by the url filter which is ran after the markdown filter.)

It would not make sense to embed a full parser. Much better to let a user use the markdown parser of their choice, and / or pandoc, to convert to text for elaborate spell checking.

Unfortunately, that probably won't work well with the existing filter framework. Aspell needs to be able to determine where the word in the document is, in order to be able to replace the word with the correct spelling. Filters basically work by simply replacing stuff that should not be spell checked with spaces so that text remains aligned.

If you just want to check a document and list misspelling you can use pandoc to convert the document to HTML and then pipe the output through aspell list --mode=html --add-html-skip=code. The output will be a list of misspellings.

@kevina
Copy link
Member Author

kevina commented Jul 16, 2019

@hrabbey ]( ) are now ignored so are link references so that [link][ref] will become [link][ ] and

[ref]: #c2 "Chapter 2"

will become

[   ]:    "Chapter 2"

but this can be turned off with --dont-markdown-skip-ref-labels.

@kevina kevina force-pushed the markdown-filter branch 5 times, most recently from 2bbc66d to 2ea2d94 Compare August 1, 2019 18:45
 - Add support for ignoring link urls.  I.e [title](link).
 - Add support backslash escaping.
 - Fix bug when there are multiple inlines in the same line.
 - Support Link References and Bug fixes
 - Support '()' for url labels.
 - Make html tag comparison case insensitive

Towards #536 & #558.
@kevina kevina merged commit 735b579 into master Aug 2, 2019
@zerok
Copy link

zerok commented Aug 4, 2019

Sorry for the late response 😭 Thank you for working on this 😍

@kevina
Copy link
Member Author

kevina commented Aug 18, 2019

A pre-release snapshot is now available with the new Markdown filter: https://github.com/GNUAspell/aspell/releases/tag/rel-0.60.8-20190817 if anyone wants to try it out and didn't want to use the git version.

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

Successfully merging this pull request may close these issues.

Please support markdown
3 participants