- Install the NodeJS packages
 - Install the Python dependencies
 
          Created
          September 29, 2025 10:09 
        
      - 
      
 - 
        
Save agoose77/f2aa22b8f59c300ec66fe4efdf4c957e to your computer and use it in GitHub Desktop.  
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import retextSpell from "retext-spell"; | |
| async function loadDictionary(dictionary) { | |
| const baseUrl = new URL(`https://unpkg.com/dictionary-${dictionary}@latest/`); | |
| const [aff, dic] = await Promise.all([ | |
| fetch(new URL("index.aff", baseUrl)), | |
| fetch(new URL("index.dic", baseUrl)), | |
| ]); | |
| if (!(aff.ok && dic.ok)) { | |
| throw new Error(`Couldn't load dictionary files from ${baseUrl}`); | |
| } | |
| return { | |
| aff: Buffer.from(await aff.arrayBuffer()), | |
| dic: Buffer.from(await dic.arrayBuffer()), | |
| }; | |
| } | |
| function plugin(options) { | |
| return async (tree, file, next) => { | |
| // The nascent beginnings of a configurable dictionary | |
| const locale = "en-gb"; | |
| let dictionary; | |
| try { | |
| dictionary = await loadDictionary(locale); | |
| } catch (error) { | |
| file.fail(String(error)); | |
| } | |
| const impl = retextSpell({ dictionary }); | |
| return impl(tree, file, next); | |
| }; | |
| } | |
| export default { | |
| plugins: [[plugin, {}]], | |
| }; | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import shutil | |
| key = "retext-language-server" | |
| c.LanguageServerManager.language_servers = { | |
| key: dict( | |
| version=2, | |
| display_name=key, | |
| mime_types=["text/x-gfm", "text/x-ipythongfm", "text/x-markdown"], | |
| argv=[ | |
| shutil.which("node"), | |
| "/tmp/tmp.O8NDAzyhVI/server.mjs", | |
| "--stdio", | |
| ], | |
| languages=["markdown", "ipythongfm", "gfm"], | |
| install=dict( | |
| npm="npm install --save-dev {}".format(key), | |
| yarn="yarn add --dev {}".format(key), | |
| jlpm="jlpm add --dev {}".format(key), | |
| ), | |
| ) | |
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | { | |
| "dependencies": { | |
| "remark": "^15.0.1", | |
| "retext": "^9.0.0", | |
| "retext-spell": "^6.1.0", | |
| "unified-language-server": "^4.0.1" | |
| } | |
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | jupyterlab-lsp | |
| python-lsp-server[all] | |
| jupyterlab | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import { retext } from "retext"; | |
| import { createUnifiedLanguageServer } from "unified-language-server"; | |
| process.title = "retext-language-server"; | |
| createUnifiedLanguageServer({ | |
| ignoreName: ".retextignore", | |
| pluginPrefix: "retext", | |
| rcName: ".retextrc", | |
| processorName: "retext", | |
| processorSpecifier: "retext", | |
| defaultProcessor: retext, | |
| }); | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment