Skip to content

Enable Plain Text Spellchecker for Markdown#9271

Open
lkishalmi wants to merge 1 commit intoapache:masterfrom
lkishalmi:enable-markdown-spellchecker
Open

Enable Plain Text Spellchecker for Markdown#9271
lkishalmi wants to merge 1 commit intoapache:masterfrom
lkishalmi:enable-markdown-spellchecker

Conversation

@lkishalmi
Copy link
Contributor

This adds the Plain Text Spellchecker which is not the best, though better than none.

Also made text/x-markdown the only MIME-TYPE used here for consistency.

It might be tempting to use text/markdown since that's the official one from 2016 RFC 7763

I've checked, that the previous MIME text/x-markdown-nb was not used anywhere else in the IDE.

@lkishalmi lkishalmi force-pushed the enable-markdown-spellchecker branch from b31a80a to aab6cde Compare March 13, 2026 20:51
Copy link
Contributor

@matthiasblaesing matthiasblaesing left a comment

Choose a reason for hiding this comment

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

The mimetype could be considered API as other modules could rely on the editor infrastructure to be in place for the concrete mimetype. Is there a reason not to use the "correct" mimetype? If we break this, why not do it only once?

For the change itself: The spellchecker has the option to be disabled on a per format basis. The implementation seems to be ugly:

The layer entries:

<folder name="Spellcheckers">
<file name="HTML">
<attr name="SystemFileSystem.localizingBundle" stringvalue="org.netbeans.modules.spellchecker.bindings.htmlxml.Bundle"/>
</file>
<file name="XHTML">
<attr name="SystemFileSystem.localizingBundle" stringvalue="org.netbeans.modules.spellchecker.bindings.htmlxml.Bundle"/>
</file>
<file name="GSP">
<attr name="SystemFileSystem.localizingBundle" stringvalue="org.netbeans.modules.spellchecker.bindings.htmlxml.Bundle"/>
</file>
<file name="JSP">
<attr name="SystemFileSystem.localizingBundle" stringvalue="org.netbeans.modules.spellchecker.bindings.htmlxml.Bundle"/>
</file>
<file name="PHP">
<attr name="SystemFileSystem.localizingBundle" stringvalue="org.netbeans.modules.spellchecker.bindings.htmlxml.Bundle"/>
</file>
<file name="XML">
<attr name="SystemFileSystem.localizingBundle" stringvalue="org.netbeans.modules.spellchecker.bindings.htmlxml.Bundle"/>
<attr name="Hidden" boolvalue="true"/>
</file>
</folder>

Are reflected into the UI:

Image

And the settings is then used in the token list (see how the "hidden" attribute is found):

https://github.com/apache/netbeans/blob/master/ide/spellchecker.bindings.htmlxml/src/org/netbeans/modules/spellchecker/bindings/htmlxml/HtmlTokenList.java

It seems strange that NB uses mimetype everywhere else, but names here.

@lkishalmi
Copy link
Contributor Author

Well, working on the Spellchecker Core at the moment. I think it's pretty old code and half of that was written by a contributor the other half by Jan. It has a few strange thing there how that handles Dictionaries and settings. It's tempting to change that, though I think it's better to leave that as it is.

Also the recent upgrade of Lucene makes it possible to use HunSpell dictionaries.
So I've updated wordlist files, downloading them from GitHub instead of OSUL.

@BradWalker
Copy link
Member

Nice!

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.

3 participants