Leeft / Star-Citizen-WebGL-Map

A WebGL version of the universe map for the upcoming game Star Citizen
MIT License
58 stars 20 forks source link

Text formatting question #8

Open vvzar opened 7 years ago

vvzar commented 7 years ago

How can I set links to open in new window? Same as target=_blank

"info" : [{
                "added" : "2014-06-25 18:09:28",
                "addedBy" : 1,
                "article" : "**Header**\n\r [(name of link)](http://somedomain.name)",

Is anywhere description for text formatting codes?

Like:

##Text## some header?
**text** - strong text?
\n\r\ - end of string?
[(linkname)](link)
Leeft commented 7 years ago

Getting links to open in a new window out of the box isn't possible as far as I'm aware, no flavour of markdown supports that. Also, it's generally frowned upon to do it (though yes, I do use it myself, as many users probably aren't aware of things like middle-clicking a link to open to a new tab). You can maybe write some JavaScript to add a target attribute to any links after the markdown has rendered.

Formatting codes: https://daringfireball.net/projects/markdown/syntax

vvzar commented 7 years ago

Thank you! Another question: When I add second block "info" to the json, cycle drawing header twice. Like:

##Information##
text
(source)
##Information##
text
(source).

Is any way to avoid this behavior? So blocks will look:

##Information##
text
(source)
text
(source)

I`m talking about this function:

17 : function (a, b, c, d, e) {
                    var f;
                    return "    <article>\n" + (null != (f = (c.uiSection || b && b.uiSection || c.helperMissing).call(null != b ? b : {}, "Information", 1, {
                                name : "uiSection",
                                hash : {},
                                fn : a.program(18, e, 0),
                                inverse : a.noop,
                                data : e
                            })) ? f : "") + "    </article>\n"
                },

This way, I can add target to the block:

19 : function (a, b, c, d, e) {
                    return '          <p class="system-blurb-source"><a href="' + a.escapeExpression(a.lambda(null != b ? b.source : b, b)) + '" target="_blank">(source)</a></p>\n'
                },

Thank you.