3
Ticket #11235
Status: Open
Opened by BoyrexMacaraya
Type:
Feature Request
Views:
343
Access:
Public
Opened:
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.

Create an account or sign in to comment.

1
03/18/2022 8:17 pm
Level 1 : New Network
BoyrexMacaraya
BoyrexMacaraya's Avatar
modified ticket description.
1
01/25/2021 12:26 amhistory
Level 16 : Journeyman Engineer
one2many
one2many's Avatar
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
01/20/2021 8:32 pmhistory
Level 16 : Journeyman Engineer
one2many
one2many's Avatar
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.
2
01/21/2021 3:57 am
Level 70 : Legendary Engineer
Bertiecrafter
Bertiecrafter's Avatar
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.
3
12/30/2020 8:45 amhistory
Level 70 : Legendary Engineer
Bertiecrafter
Bertiecrafter's Avatar
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.
1
08/29/2020 4:11 am
Level 1 : New Network
BoyrexMacaraya
BoyrexMacaraya's Avatar
modified ticket description.
1
08/29/2020 4:10 am
Level 1 : New Network
BoyrexMacaraya
BoyrexMacaraya's Avatar
modified ticket description.
Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome