mirror of
https://github.com/Redocly/redoc.git
synced 2024-11-22 16:46:34 +03:00
feat: turn off code-blocks wrapping
Can enable using `typography.code.wrap` theme option, fixes #658
This commit is contained in:
parent
f39fc98eab
commit
393681b99e
|
@ -8,7 +8,7 @@ export const jsonStyles = css`
|
|||
font-family: ${props => props.theme.typography.code.fontFamily};
|
||||
font-size: ${props => props.theme.typography.code.fontSize};
|
||||
|
||||
white-space: pre-wrap;
|
||||
white-space: ${({ theme }) => (theme.typography.code.wrap ? 'pre-wrap' : 'pre')};
|
||||
overflow-x: auto;
|
||||
|
||||
.callback-function {
|
||||
|
|
|
@ -74,7 +74,7 @@ export const StyledMarkdownBlock = withProps<{ compact?: boolean; inline?: boole
|
|||
|
||||
pre {
|
||||
font-family: ${props => props.theme.typography.code.fontFamily};
|
||||
white-space: pre-wrap;
|
||||
white-space:${({ theme }) => (theme.typography.code.wrap ? 'pre-wrap' : 'pre')};
|
||||
background-color: #263238;
|
||||
color: white;
|
||||
padding: 12px 14px 15px 14px;
|
||||
|
|
|
@ -12,7 +12,7 @@ const StyledPre = styled(PrismDiv.withComponent('pre'))`
|
|||
overflow-x: auto;
|
||||
margin: 0;
|
||||
|
||||
white-space: pre-wrap;
|
||||
white-space: ${({ theme }) => (theme.typography.code.wrap ? 'pre-wrap' : 'pre')};
|
||||
`;
|
||||
|
||||
export interface SourceCodeProps {
|
||||
|
|
|
@ -102,7 +102,6 @@ const defaultTheme: ThemeInterface = {
|
|||
fontFamily: 'Roboto, sans-serif',
|
||||
smoothing: 'antialiased',
|
||||
optimizeSpeed: true,
|
||||
|
||||
headings: {
|
||||
fontFamily: 'Montserrat, sans-serif',
|
||||
},
|
||||
|
@ -113,6 +112,7 @@ const defaultTheme: ThemeInterface = {
|
|||
fontWeight: ({ typography }) => typography.fontWeightRegular,
|
||||
color: '#e53935',
|
||||
backgroundColor: 'rgba(38, 50, 56, 0.04)',
|
||||
wrap: false,
|
||||
},
|
||||
links: {
|
||||
color: ({ colors }) => colors.primary.main,
|
||||
|
@ -271,6 +271,7 @@ export interface ResolvedThemeInterface {
|
|||
|
||||
code: FontSettings & {
|
||||
backgroundColor: string;
|
||||
wrap: boolean;
|
||||
};
|
||||
headings: {
|
||||
fontFamily: string;
|
||||
|
|
Loading…
Reference in New Issue
Block a user