This bug was reported here: https://meta.discourse.org/t/ctrl-b-selects-asterisks/27215 - It was something I broke whilst writing PR3288.
The fix checks if it is a multiline selection, if it is not (which includes blank selections) it will leave the asterisks unhighlighted.
Also fix a bug where asterisks would not be stripped if there was whitespace at the beginning of a line in a multiline selection.
Also fix styling issues I missed last time so that it matches the rest of the document. Specifically, 4 character tabs and spaces after "if"s.
This misuses the system that Pagedown has set up somewhat, but it has to in order to affect the content inside the selection. The end behaviour seems to me to be non-buggy and much more obvious to an end user.
Essentially, instead of performing the operation to surround characters on one line, it splits the selection into lines the loops the operation. But usually a single "chunk" is returned with some replacement text and markdown to insert before and after the text. Because we're replacing text inside the selections the before and after are left blank and the selection contains all the changed markdown.