Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

Handle special characters better

A topic by Muks created Apr 08, 2022 Views: 240 Replies: 5
Viewing posts 1 to 6
(1 edit)

I use code blocks quite a bit and unfortunately Deepdwn is the only application I use that converts special characters (e.g. > or &) into their codes (eg > or &) when copying and pasting from some other applications (e.g. Slack, or Jira, or a browser). I have to remember to paste the code into something like Notepad/Notepad++ first, and then into Deepdwn, and then it works.

For example, if you copy a line featuring redirect operators (> < etc) from here: https://www.gnu.org/software/bash/manual/html_node/Redirections.html straight into Deepdwn, it comes out like this:


"If >&- or <&- is preceded by {varname}"

becomes

"If >&- or <&- is preceded

by {varname},"

So you can see the conversion. Note that it happens inside and outside of code blocks. Also it's adding linebreaks where it shouldn't, but I've only just noticed that, so not sure how consistent or related that is.

Hi,

It will depend on where you’re pasting from. This behavior is part of this feature, if you’re curious.

You can still paste your content directly into Deepdwn by using the Paste as Plain Text command, Ctrl (or Command) + Shift + V.

Hope that helps!

(1 edit)

Ah, just noticed my example didn't work correctly because ironically enough this forum converts the HTML code back to the correct text. So, in case it wasn't clear:


I understand the desire to convert to Markdown but converting special characters to these codes doesn't seem like it would be useful for the purpose at all. Surely the default behaviour here should be to paste them as-is? I realise > is used for quote blocks, but an ampersand is nothing special as far as I know - and I don't think this sort of conversion behaviour by default is useful to anyone? I'm struggling to understand the use case vs it being pasted "as-is".

(5 edits)

Hi,

The goal of any escaping here isn’t to prevent your content from being treated as markdown, but to prevent pasted HTML being treated as HTML (which markdown supports).

In this case at least, Deepdwn is returning the HTML text content as is from that source, rather than doing any escaping of its own.

For instance, the author of that content didn’t need to HTML escape any of those characters, other than the <, but they did anyway, and Deepdwn happily passed them along.

Markdown’s HTML handling is less strict and would allow < in some circumstances, but not others.

[n]<word” would be allowed but “[n]<word > something” needs escaping on the opening “<”, or else “<word >” will be treated as HTML and dropped or escaped, depending on your markdown conversion.

I’ll see if there’s anything I can do to improve it, but there’s a good chance that you’d still see some escaping where you wouldn’t necessarily want it, in which case Paste as Plain Text is still the best answer.

The HTML escaping has been reduced to a minimum in v0.36. There are still some cases where things are incorrect (mostly related to pasting characters which contain markdown). I’ll look at improving that in a future update.

(+1)

I appreciate it, thank you!