Commit ba7eeb32 authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Fixed broken section links in mi browser. #242

parent 80c37c36
......@@ -34,7 +34,11 @@
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto+Mono:400,500">
<!-- icon fonts for the meta-info browser -->
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<title>NOMAD upload</title>
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
<title>NOMAD</title>
</head>
<body>
<noscript>
......
......@@ -12,198 +12,199 @@ import extend from '@babel/runtime/helpers/extends'
var styles = theme => {
return ({
root: {
fontFamily: theme.typography.fontFamily,
fontSize: 16,
color: theme.palette.text.primary,
'& .anchor-link': {
marginTop: -96,
// Offset for the anchor.
position: 'absolute'
},
'& pre, & pre[class*="language-"]': {
margin: '24px 0',
padding: '12px 18px',
backgroundColor: theme.palette.primary.veryLight,
borderRadius: theme.shape.borderRadius,
overflow: 'auto',
WebkitOverflowScrolling: 'touch' // iOS momentum scrolling.
},
'& code': {
display: 'inline-block',
lineHeight: 1.6,
fontFamily: 'Consolas, "Liberation Mono", Menlo, Courier, monospace',
padding: '3px 6px',
color: theme.palette.text.primary,
backgroundColor: theme.palette.primary.veryLight,
fontSize: 14
},
'& p code, & ul code, & pre code': {
fontSize: 14,
lineHeight: 1.6
},
'& p:first-child': {
marginTop: 0
},
'& p:last-child': {
marginBottom: 0
},
'& h1': (0, extend)({}, theme.typography.h3, {
color: theme.palette.text.primary,
margin: '32px 0 16px'
}),
'& .description': (0, extend)({}, theme.typography.h5, {
margin: '0 0 40px'
}),
'& h2': (0, extend)({}, theme.typography.h4, {
root: {
fontFamily: theme.typography.fontFamily,
fontSize: 16,
color: theme.palette.text.primary,
margin: '32px 0 24px'
}),
'& h3': (0, extend)({}, theme.typography.h5, {
color: theme.palette.text.primary,
margin: '32px 0 24px'
}),
'& h4': (0, extend)({}, theme.typography.h6, {
color: theme.palette.text.primary,
margin: '24px 0 16px'
}),
'& p, & ul, & ol': {
lineHeight: theme.typography.lineHeight,
marginBottom: theme.spacing.unit
},
'& ul': {
paddingLeft: 0,
'& li': {
listStyleType: 'none',
fontSize: 'inherit',
paddingLeft: theme.spacing.unit * 4,
'&:before': {
content: '\'\'',
fontSize: 'x-large',
marginLeft: -theme.spacing.unit * 4,
paddingRight: theme.spacing.unit * 4 - 14
}
}
},
'& .anchor-link': {
marginTop: -96,
// Offset for the anchor.
position: 'absolute'
},
'& pre, & pre[class*="language-"]': {
margin: '24px 0',
padding: '12px 18px',
backgroundColor: theme.palette.primary.veryLight,
borderRadius: theme.shape.borderRadius,
overflow: 'auto',
WebkitOverflowScrolling: 'touch' // iOS momentum scrolling.
'& h1, & h2, & h3, & h4': {
},
'& code': {
fontSize: 'inherit',
lineHeight: 'inherit',
// Remove scroll on small screens.
wordBreak: 'break-word'
display: 'inline-block',
lineHeight: 1.6,
fontFamily: 'Consolas, "Liberation Mono", Menlo, Courier, monospace',
padding: '3px 6px',
color: theme.palette.text.primary,
backgroundColor: theme.palette.primary.veryLight,
fontSize: 14
},
'& .anchor-link-style': {
opacity: 0,
// To prevent the link to get the focus.
display: 'none'
'& p code, & ul code, & pre code': {
fontSize: 14,
lineHeight: 1.6
},
'&:hover .anchor-link-style': {
display: 'inline-block',
opacity: 1,
padding: '0 8px',
color: theme.palette.text.hint,
'&:hover': {
color: theme.palette.text.secondary
'& p:first-child': {
marginTop: 0
},
'& p:last-child': {
marginBottom: 0
},
'& h1': (0, extend)({}, theme.typography.h3, {
color: theme.palette.text.primary,
margin: '32px 0 16px'
}),
'& .description': (0, extend)({}, theme.typography.h5, {
margin: '0 0 40px'
}),
'& h2': (0, extend)({}, theme.typography.h4, {
color: theme.palette.text.primary,
margin: '32px 0 24px'
}),
'& h3': (0, extend)({}, theme.typography.h5, {
color: theme.palette.text.primary,
margin: '32px 0 24px'
}),
'& h4': (0, extend)({}, theme.typography.h6, {
color: theme.palette.text.primary,
margin: '24px 0 16px'
}),
'& p, & ul, & ol': {
lineHeight: theme.typography.lineHeight,
marginBottom: theme.spacing.unit
},
'& ul': {
paddingLeft: 0,
'& li': {
listStyleType: 'none',
fontSize: 'inherit',
paddingLeft: theme.spacing.unit * 4,
'&:before': {
content: '\'\'',
fontSize: 'x-large',
marginLeft: -theme.spacing.unit * 4,
paddingRight: theme.spacing.unit * 4 - 14
}
}
},
'& h1, & h2, & h3, & h4': {
'& code': {
fontSize: 'inherit',
lineHeight: 'inherit',
// Remove scroll on small screens.
wordBreak: 'break-word'
},
'& .anchor-link-style': {
opacity: 0,
// To prevent the link to get the focus.
display: 'none'
},
'& svg': {
width: '0.55em',
height: '0.55em',
fill: 'currentColor'
'&:hover .anchor-link-style': {
display: 'inline-block',
opacity: 1,
padding: '0 8px',
color: theme.palette.text.hint,
'&:hover': {
color: theme.palette.text.secondary
},
'& svg': {
width: '0.55em',
height: '0.55em',
fill: 'currentColor'
}
}
}
},
'& table': {
width: '100%',
display: 'block',
overflowX: 'auto',
WebkitOverflowScrolling: 'touch',
// iOS momentum scrolling.
borderCollapse: 'collapse',
borderSpacing: 0,
overflow: 'hidden',
'& .prop-name': {
fontSize: 13,
fontFamily: 'Consolas, "Liberation Mono", Menlo, monospace'
},
'& .required': {
color: theme.palette.type === 'light' ? '#006500' : '#9bc89b'
'& table': {
width: '100%',
display: 'block',
overflowX: 'auto',
WebkitOverflowScrolling: 'touch',
// iOS momentum scrolling.
borderCollapse: 'collapse',
borderSpacing: 0,
overflow: 'hidden',
'& .prop-name': {
fontSize: 13,
fontFamily: 'Consolas, "Liberation Mono", Menlo, monospace'
},
'& .required': {
color: theme.palette.type === 'light' ? '#006500' : '#9bc89b'
},
'& .prop-type': {
fontSize: 13,
fontFamily: 'Consolas, "Liberation Mono", Menlo, monospace',
color: theme.palette.type === 'light' ? '#932981' : '#dbb0d0'
},
'& .prop-default': {
fontSize: 13,
fontFamily: 'Consolas, "Liberation Mono", Menlo, monospace',
borderBottom: '1px dotted '.concat(theme.palette.text.hint)
}
},
'& .prop-type': {
fontSize: 13,
fontFamily: 'Consolas, "Liberation Mono", Menlo, monospace',
color: theme.palette.type === 'light' ? '#932981' : '#dbb0d0'
'& thead': {
fontSize: 14,
fontWeight: theme.typography.fontWeightMedium,
color: theme.palette.text.secondary
},
'& tbody': {
fontSize: 14,
lineHeight: 1.5,
color: theme.palette.text.primary
},
'& td': {
borderBottom: '1px solid '.concat(theme.palette.divider),
padding: '8px 16px 8px 8px',
textAlign: 'left'
},
'& .prop-default': {
'& td:last-child': {
paddingRight: 24
},
'& td compact': {
paddingRight: 24
},
'& td code': {
fontSize: 13,
fontFamily: 'Consolas, "Liberation Mono", Menlo, monospace',
borderBottom: '1px dotted '.concat(theme.palette.text.hint)
}
},
'& thead': {
fontSize: 14,
fontWeight: theme.typography.fontWeightMedium,
color: theme.palette.text.secondary
},
'& tbody': {
fontSize: 14,
lineHeight: 1.5,
color: theme.palette.text.primary
},
'& td': {
borderBottom: '1px solid '.concat(theme.palette.divider),
padding: '8px 16px 8px 8px',
textAlign: 'left'
},
'& td:last-child': {
paddingRight: 24
},
'& td compact': {
paddingRight: 24
},
'& td code': {
fontSize: 13,
lineHeight: 1.6
},
'& th': {
whiteSpace: 'pre',
borderBottom: '1px solid '.concat(theme.palette.divider),
fontWeight: theme.typography.fontWeightMedium,
padding: '0 16px 0 8px',
textAlign: 'left'
},
'& th:last-child': {
paddingRight: 24
},
'& tr': {
height: 48
},
'& thead tr': {
height: 64
},
'& strong': {
fontWeight: theme.typography.fontWeightMedium
},
'& blockquote': {
borderLeft: '5px solid '.concat(theme.palette.text.hint),
backgroundColor: theme.palette.background.paper,
padding: '4px 24px',
margin: '24px 0'
},
'& a, & a code': {
lineHeight: 1.6
},
'& th': {
whiteSpace: 'pre',
borderBottom: '1px solid '.concat(theme.palette.divider),
fontWeight: theme.typography.fontWeightMedium,
padding: '0 16px 0 8px',
textAlign: 'left'
},
'& th:last-child': {
paddingRight: 24
},
'& tr': {
height: 48
},
'& thead tr': {
height: 64
},
'& strong': {
fontWeight: theme.typography.fontWeightMedium
},
'& blockquote': {
borderLeft: '5px solid '.concat(theme.palette.text.hint),
backgroundColor: theme.palette.background.paper,
padding: '4px 24px',
margin: '24px 0'
},
'& a, & a code': {
// Style taken from the Link component
color: theme.palette.primary.main,
textDecoration: 'none',
'&:hover': {
textDecoration: 'underline'
color: theme.palette.primary.main,
textDecoration: 'none',
'&:hover': {
textDecoration: 'underline'
}
},
'& img': {
maxWidth: '100%'
}
},
'& img': {
maxWidth: '100%'
}
}
})}
})
}
function Markdown(props) {
const { classes, text, children } = props
......
......@@ -226,6 +226,7 @@ export default class MetaInfoRepository {
if (isSection) {
definition.mType = schema.section
definition.features = []
} else if (isCategory) {
definition.mType = schema.category
} else if (isValue) {
......
......@@ -127,7 +127,7 @@ class DefinitionCardUnstyled extends React.Component {
}
renderDescription(description) {
description = description.replace(/(([A-Za-z0-9]+_)+[A-Za-z0-9]+)/g, '`$1`')
description = description.replace(/[^([A-Za-z0-9](([A-Za-z0-9]+_)+[A-Za-z0-9]+)[^)[A-Za-z0-9]/g, '`$1`')
return (
<Markdown>{description}</Markdown>
)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment