fixed h tag height issue

This commit is contained in:
u-e 2019-02-27 23:21:41 +03:00
parent 30c3fe865d
commit fe67cb1acc
2 changed files with 23 additions and 0 deletions

View File

@ -14,6 +14,22 @@ export default EStyleSheet.create({
color: '$primaryBlue',
fontFamily: '$primaryFont',
},
h4: {
fontSize: 15,
marginHorizontal: 10,
// height: 10,
marginBottom: 5,
marginTop: 5,
},
h1: {
fontSize: 30,
},
h2: {
fontSize: 25,
},
h3: {
fontSize: 20,
},
img: {
// height: 50,
marginTop: 10,

View File

@ -22,6 +22,7 @@ const urlRegex = /(http|ftp|https):\/\/([\w_-]+(?:(?:\.[\w_-]+)+))([\w.,@?^=%&:/
const aTagRegex = /(<\s*a[^>]*>(.*?)<\s*[/]\s*a>)/g;
const imgTagRegex = /(<img[^>]*>)/g;
const iframeRegex = /(?:<iframe[^>]*)(?:(?:\/>)|(?:>.*?<\/iframe>))/g;
const hTagRegex = /(<h([1-6])>([^<]*)<\/h([1-6])>)/g;
export const markDown2Html = (input) => {
if (!input) {
@ -81,6 +82,10 @@ export const markDown2Html = (input) => {
output = handleATag(output);
}
if (hTagRegex.test(output)) {
output = handleHTag(output);
}
// if (copiedPostRegex.test(output)) {
// output = handleMarkdownLink(output);
// }
@ -130,6 +135,8 @@ const handleATag = input => input.replace(aTagRegex, (link) => {
return link;
});
const handleHTag = input => input.replace(hTagRegex, tag => `<div>${tag}</div>`);
const handleMarkdownLink = input => input.replace(copiedPostRegex, (link) => {
const postMatch = link.match(copiedPostRegex);