Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

code block formatting broken #7142

Closed
sbts opened this issue Aug 4, 2018 · 12 comments
Closed

code block formatting broken #7142

sbts opened this issue Aug 4, 2018 · 12 comments
Labels
A-Timeline P2 T-Defect X-Needs-Info This issue is blocked awaiting information from the reporter

Comments

@sbts
Copy link

sbts commented Aug 4, 2018

triple backtick codeblockes no longer behave cleanly. The used to sit inside a div with changed background color and a copy content button. They now only seem to have the text background color changed. And otherwise behave like ordinary text. This is an issue for riot web and android at a minimum

@kronos003
Copy link

I note the same as above. Tested on Fedora 25 against Firefox 61.0.1 and Google Chrome Version 67.0.3396.99 (Official Build) (64-bit)

@lampholder
Copy link
Member

This will likely be a consequence of our migration to slate.js.

I'll dig up some examples of the difference.

@lampholder
Copy link
Member

Old version

screen shot 2018-08-13 at 17 58 58
screen shot 2018-08-13 at 17 59 05
Event:

{
  "origin_server_ts": 1534179532478,
  "sender": "@toml:matrix.org",
  "event_id": "$1534179532889966mcYAG:matrix.org",
  "unsigned": {
    "age": 3381,
    "transaction_id": "m1534179533095.6"
  },
  "content": {
    "body": "```python\ndef foo(bar):\n    return bar + 5\n```",
    "msgtype": "m.text",
    "formatted_body": "<pre><code class=\"language-python\">def foo(bar):\n    return bar + 5\n</code></pre>\n",
    "format": "org.matrix.custom.html"
  },
  "type": "m.room.message",
  "room_id": "!KbQDDYgRYgoyAWughj:lant.uk"
}

HTML:

<span class="mx_MTextBody mx_EventTile_content"><span class="mx_EventTile_body markdown-body" dir="auto"><pre><code class="language-python hljs"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">foo</span>
<span
    class="hljs-params">(bar)</span>:</span>
    <span class="hljs-keyword">return</span> bar + <span class="hljs-number">5</span>
    </code><span class="mx_EventTile_copyButton"></span></pre>
    </span>
    </span>

## New version
screen shot 2018-08-13 at 18 06 38
screen shot 2018-08-13 at 18 06 43
Event:

{
  "origin_server_ts": 1534179848023,
  "sender": "@isobelle.mtp:matrix.org",
  "event_id": "$1534179848891231tvLdZ:matrix.org",
  "unsigned": {
    "age": 7304,
    "transaction_id": "m1534179848665.55"
  },
  "content": {
    "body": "```python\ndef foo(bar):\n    return bar + 5\n```",
    "msgtype": "m.text",
    "formatted_body": "<pre><code class=\"language-python\">def foo(bar):\n    return bar + 5\n</code></pre>\n",
    "format": "org.matrix.custom.html"
  },
  "type": "m.room.message",
  "room_id": "!SkUqMWMqHDDkUEQBwe:matrix.org"
}

HTML:

<span class="mx_MTextBody mx_EventTile_content"><span class="mx_EventTile_body markdown-body" dir="auto"><div class="mx_EventTile_pre_container"><pre><code class="language-python hljs"><span class="hljs-function"><span class="hljs-keyword">def</span><span class="hljs-title">foo</span><span class="hljs-params">(bar)</span>:</span>
<span class="hljs-keyword">return</span> bar + <span class="hljs-number">5</span>
</code>
</pre><span class="mx_EventTile_copyButton"></span></div>
</span>
</span>

@t3chguy
Copy link
Member

t3chguy commented Aug 13, 2018

If you mean via the rich text editor buttons then this is intentional, it's no longer a code block button and instead an inline code block. But nothing has changed on the md side for the triple backticks so weird

@lampholder
Copy link
Member

So cosmetically I can't seem any difference here (in Riot web at least).

The old and new event bodies look the same, too:
Old:

    "body": "```python\ndef foo(bar):\n    return bar + 5\n```",
    "formatted_body": "<pre><code class=\"language-python\">def foo(bar):\n    return bar + 5\n</code></pre>\n",

New:

    "body": "```python\ndef foo(bar):\n    return bar + 5\n```",
    "formatted_body": "<pre><code class=\"language-python\">def foo(bar):\n    return bar + 5\n</code></pre>\n",

There is a difference in the HTML, though I haven't inspected that closely.

@sbts or @kronos003 - does that match what you were seeing?

@lampholder lampholder added T-Defect P2 A-Timeline type:composer X-Needs-Info This issue is blocked awaiting information from the reporter labels Aug 13, 2018
@linuxmail
Copy link

hi,

have also the same problem: I posted a snippset and on Riot (Fedora 28) it wasn't "visible"
bildschirmfoto von 2018-08-15 09-34-04

I used ``` as I used before .... but ...

"content": {
    "body": "```url=\"mongodb://fc-r02-mongodb-01.example.com:27035,fc-r02-mongodb-02.example.com:27035,fc-r02-mongodb-03.example.com:27035,qh-a07-mongodb-01.example.com:27035,qh-a07-mongodb-02.example.com:27035,qh-a07-mongodb-03.example.com:27035\"\n```\n",
    "msgtype": "m.text",
    "formatted_body": "<pre><code class=\"language-url=&quot;mongodb://fc-r02-mongodb-01.example.com:27035,fc-r02-mongodb-02.example.com:27035,fc-r02-mongodb-03.example.com:27035,qh-a07-mongodb-01.example.com:27035,qh-a07-mongodb-02.example.com:27035,qh-a07-mongodb-03.example.com:27035&quot;\"></code></pre>\n",
    "format": "org.matrix.custom.html"
  },

I tried to use "inline code" from the RTE, but that is more broken.

@triclops200
Copy link

This is still broken on android: no newlines are preserved and there is no syntax highlighting.

@t3chguy
Copy link
Member

t3chguy commented Mar 14, 2019

@triclops200 as the name of this repo suggests, this is riot-web, you might want https://github.com/vector-im/riot-android

@triclops200
Copy link

😳 my bad. Totally missed that.

@t3chguy
Copy link
Member

t3chguy commented Mar 24, 2020

Is this still an issue for you in the new composer?

@linuxmail
Copy link

hi,
I have to say, that wasn't a problem anymore. From my side it can closed.

@t3chguy t3chguy closed this as completed Mar 24, 2020
@Taha-Firoz
Copy link

Triple back ticks are working on the android app

BBaoVanC added a commit to boba-best/element.boba.best that referenced this issue Nov 22, 2021
* Make double-clicking the PiP take you to the call room ([\element-hq#7142](matrix-org/matrix-react-sdk#7142)). Fixes element-hq#18421 element-hq#15920 and element-hq#18421. Contributed by @SimonBrandner.
* Add maximise widget functionality ([\element-hq#7098](matrix-org/matrix-react-sdk#7098)). Fixes element-hq#19619, element-hq#19621 element-hq#19760 and element-hq#19619.
* Add rainfall effect ([\element-hq#7086](matrix-org/matrix-react-sdk#7086)). Contributed by @justjosias.
* Add root folder to zip file created by export chat feature ([\element-hq#7097](matrix-org/matrix-react-sdk#7097)). Fixes element-hq#19653 and element-hq#19653. Contributed by @aaronraimist.
* Improve VoIP UI/UX ([\element-hq#7048](matrix-org/matrix-react-sdk#7048)). Fixes element-hq#19513 and element-hq#19513. Contributed by @SimonBrandner.
* Unified room context menus ([\element-hq#7072](matrix-org/matrix-react-sdk#7072)). Fixes element-hq#19527 and element-hq#19527.
* In forgot password screen, show validation errors inline in the form, instead of in modals ([\element-hq#7113](matrix-org/matrix-react-sdk#7113)). Contributed by @psrpinto.
* Implement more meta-spaces ([\element-hq#7077](matrix-org/matrix-react-sdk#7077)). Fixes element-hq#18634 element-hq#17295 and element-hq#18634.
* Expose power level control for m.space.child ([\#7120](matrix-org/matrix-react-sdk#7120)).
* Forget member-list query when switching out of a room ([\element-hq#7093](matrix-org/matrix-react-sdk#7093)). Fixes element-hq#19432 and element-hq#19432. Contributed by @SimonBrandner.
* Do pre-submit availability check on username during registration ([\#6978](matrix-org/matrix-react-sdk#6978)). Fixes element-hq#9545 and element-hq#9545.
* Adjust recovery key button sizes depending on text width ([\element-hq#7134](matrix-org/matrix-react-sdk#7134)). Fixes element-hq#19511 and element-hq#19511. Contributed by @weeman1337.
* Fix bulk invite button getting a negative count ([\element-hq#7122](matrix-org/matrix-react-sdk#7122)). Fixes element-hq#19466 and element-hq#19466. Contributed by @renancleyson-dev.
* Fix maximised / pinned widget state being loaded correctly ([\element-hq#7146](matrix-org/matrix-react-sdk#7146)). Fixes element-hq#19768 and element-hq#19768.
* Don't reload the page when user hits enter when entering ban reason ([\element-hq#7145](matrix-org/matrix-react-sdk#7145)). Fixes element-hq#19763 and element-hq#19763.
* Fix timeline text when sharing room layout ([\element-hq#7140](matrix-org/matrix-react-sdk#7140)). Fixes element-hq#19622 and element-hq#19622.
* Fix look of emoji verification ([\element-hq#7133](matrix-org/matrix-react-sdk#7133)). Fixes element-hq#19740 and element-hq#19740. Contributed by @SimonBrandner.
* Fixes element not remembering widget hidden state per room ([\#7136](matrix-org/matrix-react-sdk#7136)). Fixes element-hq#16672, matrix-org/element-web-rageshakes#4407, element-hq#15718 element-hq#15768 and element-hq#16672.
* Don't keep spinning if joining space child failed ([\element-hq#7129](matrix-org/matrix-react-sdk#7129)). Fixes matrix-org/element-web-rageshakes#6813 and matrix-org/element-web-rageshakes#6813.
* Guard around SpaceStore onAccountData handler prevEvent ([\element-hq#7123](matrix-org/matrix-react-sdk#7123)). Fixes element-hq#19705 and element-hq#19705.
* Fix missing spaces in threads copy ([\element-hq#7119](matrix-org/matrix-react-sdk#7119)). Fixes element-hq#19702 and element-hq#19702.
* Fix hover tile border ([\element-hq#7117](matrix-org/matrix-react-sdk#7117)). Fixes element-hq#19698 and element-hq#19698. Contributed by @SimonBrandner.
* Fix quote button ([\element-hq#7096](matrix-org/matrix-react-sdk#7096)). Fixes element-hq#19659 and element-hq#19659. Contributed by @SimonBrandner.
* Fix space panel layout edge cases ([\#7101](matrix-org/matrix-react-sdk#7101)). Fixes element-hq#19668 and element-hq#19668.
* Update powerlevel/role when the user changes in the user info panel ([\element-hq#7099](matrix-org/matrix-react-sdk#7099)). Fixes element-hq#19666 and element-hq#19666. Contributed by @SimonBrandner.
* Fix avatar disappearing when setting a room topic ([\element-hq#7092](matrix-org/matrix-react-sdk#7092)). Fixes element-hq#19226 and element-hq#19226. Contributed by @SimonBrandner.
* Fix possible infinite loop on widget start ([\#7071](matrix-org/matrix-react-sdk#7071)). Fixes element-hq#15494 and element-hq#15494.
* Use device IDs for nameless devices in device list ([\element-hq#7081](matrix-org/matrix-react-sdk#7081)). Fixes element-hq#19608 and element-hq#19608.
* Don't re-sort rooms on no-op RoomUpdateCause.PossibleTagChange ([\element-hq#7053](matrix-org/matrix-react-sdk#7053)). Contributed by @bradtgmurray.
su-ex added a commit to SchildiChat/element-web that referenced this issue Nov 24, 2021
* Make double-clicking the PiP take you to the call room ([\element-hq#7142](matrix-org/matrix-react-sdk#7142)). Fixes element-hq#18421 element-hq#15920 and element-hq#18421. Contributed by @SimonBrandner.
* Add maximise widget functionality ([\element-hq#7098](matrix-org/matrix-react-sdk#7098)). Fixes element-hq#19619, element-hq#19621 element-hq#19760 and element-hq#19619.
* Add rainfall effect ([\element-hq#7086](matrix-org/matrix-react-sdk#7086)). Contributed by @justjosias.
* Add root folder to zip file created by export chat feature ([\element-hq#7097](matrix-org/matrix-react-sdk#7097)). Fixes element-hq#19653 and element-hq#19653. Contributed by @aaronraimist.
* Improve VoIP UI/UX ([\element-hq#7048](matrix-org/matrix-react-sdk#7048)). Fixes element-hq#19513 and element-hq#19513. Contributed by @SimonBrandner.
* Unified room context menus ([\element-hq#7072](matrix-org/matrix-react-sdk#7072)). Fixes element-hq#19527 and element-hq#19527.
* In forgot password screen, show validation errors inline in the form, instead of in modals ([\element-hq#7113](matrix-org/matrix-react-sdk#7113)). Contributed by @psrpinto.
* Implement more meta-spaces ([\element-hq#7077](matrix-org/matrix-react-sdk#7077)). Fixes element-hq#18634 element-hq#17295 and element-hq#18634.
* Expose power level control for m.space.child ([\#7120](matrix-org/matrix-react-sdk#7120)).
* Forget member-list query when switching out of a room ([\element-hq#7093](matrix-org/matrix-react-sdk#7093)). Fixes element-hq#19432 and element-hq#19432. Contributed by @SimonBrandner.
* Do pre-submit availability check on username during registration ([\#6978](matrix-org/matrix-react-sdk#6978)). Fixes element-hq#9545 and element-hq#9545.
* Adjust recovery key button sizes depending on text width ([\element-hq#7134](matrix-org/matrix-react-sdk#7134)). Fixes element-hq#19511 and element-hq#19511. Contributed by @weeman1337.
* Fix bulk invite button getting a negative count ([\element-hq#7122](matrix-org/matrix-react-sdk#7122)). Fixes element-hq#19466 and element-hq#19466. Contributed by @renancleyson-dev.
* Fix maximised / pinned widget state being loaded correctly ([\element-hq#7146](matrix-org/matrix-react-sdk#7146)). Fixes element-hq#19768 and element-hq#19768.
* Don't reload the page when user hits enter when entering ban reason ([\element-hq#7145](matrix-org/matrix-react-sdk#7145)). Fixes element-hq#19763 and element-hq#19763.
* Fix timeline text when sharing room layout ([\element-hq#7140](matrix-org/matrix-react-sdk#7140)). Fixes element-hq#19622 and element-hq#19622.
* Fix look of emoji verification ([\element-hq#7133](matrix-org/matrix-react-sdk#7133)). Fixes element-hq#19740 and element-hq#19740. Contributed by @SimonBrandner.
* Fixes element not remembering widget hidden state per room ([\#7136](matrix-org/matrix-react-sdk#7136)). Fixes element-hq#16672, matrix-org/element-web-rageshakes#4407, element-hq#15718 element-hq#15768 and element-hq#16672.
* Don't keep spinning if joining space child failed ([\element-hq#7129](matrix-org/matrix-react-sdk#7129)). Fixes matrix-org/element-web-rageshakes#6813 and matrix-org/element-web-rageshakes#6813.
* Guard around SpaceStore onAccountData handler prevEvent ([\element-hq#7123](matrix-org/matrix-react-sdk#7123)). Fixes element-hq#19705 and element-hq#19705.
* Fix missing spaces in threads copy ([\element-hq#7119](matrix-org/matrix-react-sdk#7119)). Fixes element-hq#19702 and element-hq#19702.
* Fix hover tile border ([\element-hq#7117](matrix-org/matrix-react-sdk#7117)). Fixes element-hq#19698 and element-hq#19698. Contributed by @SimonBrandner.
* Fix quote button ([\element-hq#7096](matrix-org/matrix-react-sdk#7096)). Fixes element-hq#19659 and element-hq#19659. Contributed by @SimonBrandner.
* Fix space panel layout edge cases ([\#7101](matrix-org/matrix-react-sdk#7101)). Fixes element-hq#19668 and element-hq#19668.
* Update powerlevel/role when the user changes in the user info panel ([\element-hq#7099](matrix-org/matrix-react-sdk#7099)). Fixes element-hq#19666 and element-hq#19666. Contributed by @SimonBrandner.
* Fix avatar disappearing when setting a room topic ([\element-hq#7092](matrix-org/matrix-react-sdk#7092)). Fixes element-hq#19226 and element-hq#19226. Contributed by @SimonBrandner.
* Fix possible infinite loop on widget start ([\#7071](matrix-org/matrix-react-sdk#7071)). Fixes element-hq#15494 and element-hq#15494.
* Use device IDs for nameless devices in device list ([\element-hq#7081](matrix-org/matrix-react-sdk#7081)). Fixes element-hq#19608 and element-hq#19608.
* Don't re-sort rooms on no-op RoomUpdateCause.PossibleTagChange ([\element-hq#7053](matrix-org/matrix-react-sdk#7053)). Contributed by @bradtgmurray.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Timeline P2 T-Defect X-Needs-Info This issue is blocked awaiting information from the reporter
Projects
None yet
Development

No branches or pull requests

7 participants