Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save hillaryfraley/09bae9ab3b223c5eb699d445d4e49b94 to your computer and use it in GitHub Desktop.
Save hillaryfraley/09bae9ab3b223c5eb699d445d4e49b94 to your computer and use it in GitHub Desktop.
Convert --- to em dash
From https://github.com/honsiorovskyi
For some reason our current dev portal renderer doesn't convert --- into em-dash (—), so I've converted them in the code using sed:
---
find . -iname '*.md' -exec sed -E -i 's/(\w)---(\w)/\1 — \2/g' {} \;
---
Unix magic does wonders! 😆
If you're using Mac OS or Linux, you can yourself run this command in the terminal, in the project directory anytime you need it. In Windows it's also possible, but probably it would be easier and faster to ask someone with Mac OS/Linux to do it (for instance, you can ping me, and I'll run it for you) 😃
@hillaryfraley
Copy link
Author

More from Denys:
Btw, did you know you can also type the dashes directly from the keyboard?

In Mac you can press ⌥ + - (option + hyphen/minus) to type the en-dash, and ⌥ + Shift + - to type the em-dash. You can find more information in this article.

And in Windows you'd probably need to install a special typographic layout to do the same. You can find the layout itself here, and some information on how to use it here.

In Linux it's also possible, and if you use it, I can tell you how to enable it there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment