Community
OpenEnergyMonitor

OpenEnergyMonitor Community

Is it true backslashes get removed?

Tags: #<Tag:0x00007fc9b1075be8>

I stumbled upon a thread on the openhab forum that had several notes like “NOTE ITS BACKSLASH #, for some unhelpful reason the forum removes the backslash” following MQTT command line examples and thought I would give it a try for myself.

# (Backslash hash)

\# (Backslash hash wrapped in ticks)

\# (Backslash hash with a 4 space indent)

blah blah blah # (Backslash hash, but not at beginning of the line)

So it seems it can be done as part of a code block just not in regular text.

Just for ref, that thread was Is anyone using the Open Energy Monitor (emonPi)

Big +1

for the use of markdown and the split screen preview.

Paul

:raised_hands: wooohoo!!! 1st badge in the bag

2 Likes

Ah yes, I’ve seen that thread. Good community at openHAB. That’s good to to know that MQTT commands and any important backslashes need to be enclosed in code blocks

Just occurred to me the backslash is probably the escape character, escaping the hash so that
# (hash escaped by backslash)
doesn’t get seen as

(unescaped hash will show this comment as h1 text)

so I wonder if the escape char can also be escaped using
\# (double backslash hash)
and if so would it also work within text eg
blah blah blah \# (double backslash hash)

I also wondered if quoted backslashes were affected eg “blah blah blah \# (double backslash hash)”

So a backslash can escape other characters eg *bold* would be bold without the leading backslash, it can also be escaped using a double backslash.

This would then imply a # has purpose within text and it seems a single hash inserts a forum category link eg #site-feedback and a double hash inserts a tag link eg #test (but displays only one hash).whilst #important doesn’t do anything . Whilst links to Twitter feeds can be shown as [#openenergymonitor] (https://twitter.com/hashtag/openenergymonitor) in blue. Interesting stuff!!

Paul

1 Like

So to get around it simply change \#text to \\#text

The above is just a test post to show the use of an escape backslash doesn’t work when quoting/linking “the fix” in another thread see Marking a topic as solved.

The above test post says “So to get around it simply change \#text to \\#text” but when linked it shows as “So to get around it simply change #text to #text” in the preview, which is not helpful since it removes the vital " / ".

This is an incorrect “quote” of the line in the original post

This is a link to the post itself, the unexpanded view is wrong but is correct when expanded using the down arrow.

http://community.openenergymonitor.org/t/is-it-true-backslashes-get-removed/46/5?u=pb66

Note - to get the double backslash to show there are a total of 4 backslashes, each displayed backslash has to be individually escaped. so \\\\#text is shown as \\#text (same text without being wrapped in backticks).