Skip to content

VSCode extension for quick replacements of accented characters into html entities.

License

Notifications You must be signed in to change notification settings

enriquein/htmlentity-replacer

Repository files navigation

HTML accented character converter

VSCode extension for quick replacements of accented characters into html entities. Useful if you are working with localizable strings that contain special characters and you wish to replace them with their corresponding HTML entities.

Demo

Demo

Features

This extension adds a command to Visual Studio Code to replace special characters into html entities. The command will appear in your Command Palette as Replace special characters with Html entities. It includes 204 common special character replacements. For example, here's a partial list of some of them:

  • Á -> Á
  • é -> é
  • í -> í
  • Ó -> Ó
  • ø -> ø
  • ù -> ù
  • Ü -> Ü
  • ü -> ü
  • µ -> µ
  • Ç -> Ç
  • ¿ -> ¿
  • ¡ -> ¡
  • ™ -> ™
  • ℠ -> ℠

Note that it does not include replacing of " (") because of how common they are under some scenarios when dealing with localizable strings within files and source code.

From version 2.0 the extension supports adding your own replacements, and even overriding existing ones. To do this, you can edit the settings.json file and add an object with property name of htmlentityreplacer.overrides. For example, if you wanted to add a replacement for ", and also override the built-in replacement for á:

{
    // other user scope vscode settings... ,
    "htmlentityreplacer.overrides": {
        "\"": """,
        "á": "á"
    }
}

This would also allow you to "disable" some replacements if this is necessary for your use case. To do this, you can simply add a replacement where the value being replaced is the same as the original. It's easier to explain with code. For example, to disable replacing ¿:

{
    // other user scope vscode settings... ,
    "htmlentityreplacer.overrides": {
        "¿": "¿"
    }
}

Thanks

Many thanks to @developerG27, @cadukich, @pszxzsd, and @vgdsouza for their contributions.

About

VSCode extension for quick replacements of accented characters into html entities.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published