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-family: ${props => props.theme.typography.code.fontFamily};
|
||||||
font-size: ${props => props.theme.typography.code.fontSize};
|
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;
|
overflow-x: auto;
|
||||||
|
|
||||||
.callback-function {
|
.callback-function {
|
||||||
|
|
|
@ -74,7 +74,7 @@ export const StyledMarkdownBlock = withProps<{ compact?: boolean; inline?: boole
|
||||||
|
|
||||||
pre {
|
pre {
|
||||||
font-family: ${props => props.theme.typography.code.fontFamily};
|
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;
|
background-color: #263238;
|
||||||
color: white;
|
color: white;
|
||||||
padding: 12px 14px 15px 14px;
|
padding: 12px 14px 15px 14px;
|
||||||
|
|
|
@ -12,7 +12,7 @@ const StyledPre = styled(PrismDiv.withComponent('pre'))`
|
||||||
overflow-x: auto;
|
overflow-x: auto;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
|
||||||
white-space: pre-wrap;
|
white-space: ${({ theme }) => (theme.typography.code.wrap ? 'pre-wrap' : 'pre')};
|
||||||
`;
|
`;
|
||||||
|
|
||||||
export interface SourceCodeProps {
|
export interface SourceCodeProps {
|
||||||
|
|
|
@ -102,7 +102,6 @@ const defaultTheme: ThemeInterface = {
|
||||||
fontFamily: 'Roboto, sans-serif',
|
fontFamily: 'Roboto, sans-serif',
|
||||||
smoothing: 'antialiased',
|
smoothing: 'antialiased',
|
||||||
optimizeSpeed: true,
|
optimizeSpeed: true,
|
||||||
|
|
||||||
headings: {
|
headings: {
|
||||||
fontFamily: 'Montserrat, sans-serif',
|
fontFamily: 'Montserrat, sans-serif',
|
||||||
},
|
},
|
||||||
|
@ -113,6 +112,7 @@ const defaultTheme: ThemeInterface = {
|
||||||
fontWeight: ({ typography }) => typography.fontWeightRegular,
|
fontWeight: ({ typography }) => typography.fontWeightRegular,
|
||||||
color: '#e53935',
|
color: '#e53935',
|
||||||
backgroundColor: 'rgba(38, 50, 56, 0.04)',
|
backgroundColor: 'rgba(38, 50, 56, 0.04)',
|
||||||
|
wrap: false,
|
||||||
},
|
},
|
||||||
links: {
|
links: {
|
||||||
color: ({ colors }) => colors.primary.main,
|
color: ({ colors }) => colors.primary.main,
|
||||||
|
@ -271,6 +271,7 @@ export interface ResolvedThemeInterface {
|
||||||
|
|
||||||
code: FontSettings & {
|
code: FontSettings & {
|
||||||
backgroundColor: string;
|
backgroundColor: string;
|
||||||
|
wrap: boolean;
|
||||||
};
|
};
|
||||||
headings: {
|
headings: {
|
||||||
fontFamily: string;
|
fontFamily: string;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user