Giter Site home page Giter Site logo

enriquein / htmlentity-replacer Goto Github PK

View Code? Open in Web Editor NEW
8.0 3.0 5.0 106 KB

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

License: Apache License 2.0

JavaScript 100.00%
accented-characters html-entities special-characters vscode-extension

htmlentity-replacer's Introduction

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.

htmlentity-replacer's People

Contributors

cadukich avatar developerg27 avatar enriquein avatar pszxzsd avatar vgdsouza avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

htmlentity-replacer's Issues

Doesn' t work

command 'extension.htmlentity-replacer' not found

Status inquiry

Is this project still active. I would like to pick it up and renew it for latest VSC version and add some other functionality to it as well, such as reverse replacer and running it only for the selection. Please let me know if I can reuse your code.

Thanks!

&amp !

Since 1.3.0, the &amp has been added and destroy every other replaces.

If you replace twice on same file, everything is broken.

Is there a way to ignore some replace ? like & -> &

Replace characters in selected text only

Hello,
would it be possible to add the feature, that characters are only replaced in the selected area of a text file?
This would be very helpful to avoid e. g. replacing characters in comments.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.