Skip to content

Conversation

@FlightControl-User
Copy link

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

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 <em>CARGO</em> DISPATCHER.
\_AI\_CARGO\_DISPATCHER gives <em>AI</em>CARGO\_DISPATCHER
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant