Template talk:Markup

Latest comment: 7 days ago by Daask in topic Line breaks and syntaxhighlight

Merge edit

I created a similar template, {{Wikitext example}} The two should probably be merged. Comparing the two:

  • {{Wikitext example}} leaves the normal border around the table. This is just cosmetic, and I don't care either way.
  • {{Wikitext example}} has direct support for multiple rows (by repeating the code), but of course {{markup}} has a usable work-around for this.
  • {{Wikitext example}} renders the right column in the default font, rather than "<samp>". I actually prefer this quite a bit; you want the user to see what they are going to get accurately.
  • Finally, I think the title "Wikitext example" is more informative.
  • A few other technical differences with the width and so on, which I don't care about.

What do you think? The only points I feel strongly about are the title and the font on the right.

The merge is easy, of course, because they take exactly the same parameters, and I never got around to using "Wikitext example" in the documentation pages. I tried it out in {{Harvard citation documentation}} and WP:Verification methods as well, just to see if it looked good on those pages. ---- CharlesGillingham (talk) 18:48, 24 February 2012 (UTC)Reply

I wasn't aware of this template until recently, which is why I created {{markup}}. I chose the name because it can be used for purposes other than template documentation.
Which output style do you prefer: plain or formatted with <samp> (it's not <tt>)? I just added that and am iffy on it myself. ---— Gadget850 (Ed) talk 19:22, 24 February 2012 (UTC)Reply
I guess the name isn't really that big an issue. It's just "documentation assistance" template, after all; no one will use it except for a few of us.
I think the right side should appear in Wikipedia's normal font, so that it looks just like the rest of Wikipedia. ---- CharlesGillingham (talk) 21:06, 24 February 2012 (UTC)Reply
I reverted the font. Seemed like a good idea at the time, but I wasn't stuck on it. ---— Gadget850 (Ed) talk 22:02, 24 February 2012 (UTC)Reply
And finally got around to adding more rows. ---— Gadget850 (Ed) talk 16:46, 25 February 2012 (UTC)Reply
Looks great. I removed any uses of my version and I'm going to have it deleted. They are merged. ---- CharlesGillingham (talk) 02:34, 26 February 2012 (UTC)Reply

Line breaks edit

The template shows a strange effect on Wikipedia:Line-break handling#Causing line breaks (relevant version of the page). The "renders as" part does have a line break after "A single newline in the markup does not cause a visible line break.", but it obviously shouldn't have. For now I'll remove the markup template and use a wikitable instead. Huon (talk) 22:26, 28 December 2012 (UTC)Reply

For the record (should anyone happen across this note), the rendering issue with {{markup}} and single newlines has apparently been fixed in the intervening half-decade, as the linked page version now renders correctly. I removed the extra hoops that were being jumped through in the Wikipedia:Line-break handling source to work around the former bug. -- FeRD_NYC (talk) 09:16, 5 July 2018 (UTC)Reply

Documentation: alternative edit

As an alternative to fake references and headings, one can use &lt; instead of < to avoid using fake references. One can also use &#61; instead of the first = (to avoid wrong level headings) to make the heading's markup be rendered as plain code instead of a heading. See here. Alfa-ketosav (talk) 13:51, 1 July 2021 (UTC)Reply

But the source text side has to be in <nowiki>...</nowiki> tags in any case -- so I think you're solving the wrong problem. "Fake heading" is used to keep any headings inside the box out of the table of contents. ---- CharlesGillingham (talk) 04:15, 22 September 2021 (UTC)Reply

Row height edit

One reason not to use this template right now is excessive row height. I put some examples for comparison at Template:Markup/testcases#Row-height examples. (I'm not sure where is the most appropriate place to put this kind of large example for discussion.) I have tested and the issue appears with multiple skins, eg. Vector 2022, Monobook, and Timeless.

On (old) Vector skin, the rows are currently 48.4 pixels tall, when my alternative to Template:Markup, a simple Wikitable, has rows that are only 24.1 pixels tall. Thus Template:Markup is twice as tall as my alternative, with an excess of 24.3 pixels per row. With Vector-2022, it's similar, with an excess of 19 pixels.

With Vector-2022, here are the row heights (obtained via Firefox Developer Tools):

  • 48px Default
  • 38px using existing template parameters (with line-height, with paragraph padding and margins)
  • 33px without line-height, with paragraph padding and margins
  • 24px with line-height, without paragraph padding and margins
  • 19px without line height, without paragraph padding and margins
  • 29px Comparison Wikitable

Contributing factors and possible solutions:

  1. Padding in Template:Markup/row, which I can overwrite with |col1style= and |col2style= eg, Template:Markup/testcases#Reduced padding.
  2. Line-height set in the vector skin:
    @media screen { .vector-body  {line-height} }
    @media screen { pre, .mw-code {line-height} }
    
    I'm not sure how to overwrite this.
  3. <p> margins and padding. I'm not sure how to overwrite this. Perhaps we can modify Template:Markup so there isn't a <p> at all?

Of course, we probably don't actually want to eliminate all padding.

How could we modify Template:Markup to make it possible to have reduced row height? Can we make Template:Markup as compact as a simple Wikitable? Daask (talk) 17:32, 1 March 2024 (UTC)Reply

  Fixed I removed the paragraph element from the right column, which reduced the default row height to a more reasonable size. Also, with the already-existing parameters, |col1style= and |col2style=, all remaining padding can be eliminated (not that I recommend that). Please respond if you have concerns about this new reduced default row height or the lack of a paragraph element in the second column. Daask (talk) 20:01, 1 March 2024 (UTC)Reply
I think this change broke cases in which the second parameter contains a template that generates a table, since table markup needs to start on a new line. I think the spacing problems, if they are new, are related to T352875. I have created T358921 to link to this discussion and two other related template discussions. – Jonesey95 (talk) 22:18, 1 March 2024 (UTC)Reply

Line breaks and syntaxhighlight edit

mw:Extension:SyntaxHighlight usually preserves line breaks in its contents, but it doesn't when the inline parameter is set. This template has used the inline parameter since SyntaxHighlight was first introduced by WOSlinker in February 2024. (Thanks!) I'm inclined to add a non-inline option in order to preserve line breaks, but I can't decide on the interface. Options:

  1. Add special values for the |tag=, namely |tag=syntaxhighlight-inline and |tag=syntaxhighlight-block, with one of these being the default for |tag=syntaxhighlight.
  2. Add a new parameter |preserve-newlines=yes/no. |preserve-newlines=no with |tag=(empty) is the same as |tag=span. |preserve-newlines=no with |tag=pre is an error. |preserve-newlines=yes with |tag=any value except pre or syntaxhighlight is an error
  3. Remove parameter |tag= entirely and replace it with |syntaxhighlight=yes/no and |preserve-newlines=yes/no to obscure implementation details from users.
  4. |codeparam=inline{{=}}yes/no modeled after |codestyle=display:block. Unfortunately, mw:Extension:SyntaxHighlight#inline appears to ignore all values supplied to it's inline parameter. inline=0, inline=no, inline=false, inline=1, and inline with no value all activate the inline feature.

I'm inclined to go with option 3. The tag parameter is only a few months old, so breaking the existing interface doesn't seem as dramatic as it would with a long-existing parameter. Thoughts? Daask (talk) 19:57, 29 April 2024 (UTC)Reply