Ticket #11235

3
Type
Feature Request
Status
Open
Opened by
Views
395
Access
Public
Created
8/29/20 4:06 am 8/29/20 4:06 am

Inline code blocks

As shown below, code blocks with multiple lines can be used in text formatting:
{
  "rewards": {
    "function": "minecraft:root"
  },
  "criteria": {
    "tick": {
      "trigger": "minecraft:tick",
      "conditions": {}
    }
  },
  "requirements": [
    [
      "tick"
    ]
  ]
}

However, attempting to use inline code blocks causes the text below to be shown instead:
Added the minecraft: namespace before certain arguments in certain data pack files

A simple workaround is to highlight text in light blue as shown below:
Added the minecraft: namespace before certain arguments in certain data pack files

A new text format can be added to support inline code blocks and grant more freedom to creators, and then the existing code block format can be renamed afterwards if appropriate.

  Have something to say?

JoinSign in

BoyrexMacaraya
03/18/2022 8:17 pm
Level 1 : New Network
modified ticket description.
1
In2itivity
01/25/2021 12:26 am
Level 18 : Journeyman System
history
Okay, after scratching my head for good ways to come up with a fix, I'm proud to say that I've made a userscript that lets you do this for now, until an official fix is implemented.

Simply copy and paste this code into Tampermonkey:
// ==UserScript==
// @name PMC: Inline Code
// @namespace tampermonkey.net/
// @version 1.0
// @description Add inline code abilities to PMC
// @author ExpertCoder14
// @match *://www.planetminecraft.com/*
// @grant none
// ==/UserScript==

(function() {
'use strict';
window.addEventListener('load', function() {
$('head').append("<style> code { display: inline; padding: 1px; padding-left: 3px; padding-right: 3px;} br + code {display: block; padding: 10px;}</style>");
}, false);
})();
Reload the page and you'll quickly realize that inline code spans are awesome!
1
In2itivity
01/20/2021 8:32 pm
Level 18 : Journeyman System
history
As a commands user, it frustrates me when a website does not have inline code blocks. For us, it's almost a necessity, just like in your example above.


The most annoying thing about this site is that the designers chose to use the HTML element <code> for a code block, which is a terrible choice. The correct HTML for a code block is <pre> and the whole meaning for <code> is for inline code.

I've tried to insert inline code into the system in many ways, but it seems like the system just won't let me.

Some ways I've tried:

  • <code style="display: inline;">minecraft:</code>

  • <span style="font-family: monospace;"></span>
Neither of these seem to work, unfortunately.
1
Bertiecrafter
01/21/2021 3:57 am
Level 72 : Legendary System
It was only a recent change that the code blocks preserve whitespace and who knows how it worked a couple changes back. It might have seemed more logical at the time to use the code instead of pre tag.
2
Bertiecrafter
12/30/2020 8:45 am
Level 72 : Legendary System
history
Yup, a monospace span style with maybe a very thin border would be very useful. When the code is too long to fit the remaining space, it should just move to a next line. AKA, it should prefer to move to the next line before the line wraps around within the inline code.
3
BoyrexMacaraya
08/29/2020 4:11 am
Level 1 : New Network
modified ticket description.
1
BoyrexMacaraya
08/29/2020 4:10 am
Level 1 : New Network
modified ticket description.
1

Welcome