TOML lang line breaks on section
See original GitHub issueInformation
- Language:
TOML
- Plugins:
none
Description
Prism create punctuation element for [[section]]
in toml
Code snippet
App.js
import React from "react";
import Prism from "prismjs";
import "prismjs/components/prism-toml";
const App = () => {
return (
<PrismCode language="toml">
{`[[redirects]]
from = ""
to = ""
status = 301`.trim()}
</PrismCode>
);
};
export default class PrismCode extends React.Component {
constructor(props) {
super(props)
this.ref = React.createRef()
}
componentDidMount() {
this.highlight()
}
componentDidUpdate() {
this.highlight()
}
highlight = () => {
if (this.ref && this.ref.current) {
Prism.highlightElement(this.ref.current)
}
}
render() {
const { children, plugins, language } = this.props
console.log(children);
return (
<pre className={!plugins ? "" : plugins.join(" ")}>
<code ref={this.ref} className={`language-${language}`}>
{children}
</code>
</pre>
)
}
}
it render :
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Proposal: Allow newlines and trailing commas in inline tables ...
Most new comers to TOML will be familiar with a table/object being defined this way and it'd click, until they realize it breaks...
Read more >Entering a two-line value for a configuraton key in config.toml
I am simply changing values in the config.toml file for the Icarus theme in Hugo. This file is part of the hugo-icarus-theme and...
Read more >TOML: Tom's Obvious Minimal Language
(a single sentence with no line breaks). Literal strings are surrounded by single quotes. No escaping is performed so what you see is...
Read more >Create new line on TOML file - Stack Overflow
I am trying to understand the TOML structure and
Read more >Learn toml in Y Minutes
TOML should be easy to parse into data structures in a wide variety of languages. ... The first newline is trimmed in raw...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thanks @RunDevelopment for the guess. Indeed, there were additional styles applied to
redirect
. In my case, Tailwind CSS was the culprit because when you use the@tailwind utilities
directive it injects a.table
class whosedisplay
property is set totable
(hence the line breaks becausetable
is a block-level element).In order to get around this “style glitch”, I simply overrode the
display
property withinitial
:Looking at the issue again, my best guess is that
display: block
got applied toredirects
. The HTML ofredirects
is<span class="token table class-name">redirects</span>
and you probably have a.table
rule (or similar) in your stylesheets.