markdown icon indicating copy to clipboard operation
markdown copied to clipboard

Updated <em> tag logic using _

Open FlightControl-User opened this issue 7 years ago • 0 comments

In markdown, an _ is something special ... One cannot just scan for every _ in a text and emphasize every text between _ (underscores). In many program languages, _ are used to represent a space in identifiers and functions etc.

Therefore, I've updated the markdown.lua logic to ensure that text between _ is only emphasized when the first _ starts with a space or any other non alpameric character, or the _ starts at the beginning of the text.

examples:

AI_CARGO_DISPATCHER gives AI_CARGO_DISPATCHER. AI _CARGO_ DISPATCHER gives AI CARGO DISPATCHER. _AI_CARGO_DISPATCHER gives AICARGO_DISPATCHER.

but!

AI*CARGO*DISPATCHER would still gives AICARGODISPATCHER !

I think this change makes a lot of sense and I hope this can be incorporated in the main master branch. The way how I coded this may not be the most efficient, but I am sure that you'll understand why I approached the problem like this.

I have added tests.sven to the test mix to ensure that the above is properly tested.

One test case in the original test cases now will give an error, and I think you need to review this. The test case itself is I think a lot of bollocks :-) I think this test case can be safely removed from the set, but it is your decision what to do with it :-)

thanks for your advice and I hope this pull request can be accepted!

Sven (FlightControl) Van de Velde

FlightControl-User avatar Jul 05 '18 06:07 FlightControl-User