-
-
Notifications
You must be signed in to change notification settings - Fork 37
Table align not working #28
Comments
Interesting, was it dropped recently or never supported? I guess we best add classes in that case, right? |
I don't know when React started to ignore it. |
But adding classes requires CSS styling in every application. |
I’d like to get someone else’s input on this as well, but I’m OK with requiring CSS: it’s better than inline styles at least. |
found a way to avoid this issue using import React, { createElement } from 'react'
import remark from 'remark'
import remarkReact from 'remark-react'
function createTableCellComponent (tagName) {
return class TableCell extends React.Component {
render () {
const style = { textAlign: this.props.align }
const props = { ...this.props, style }
return createElement(tagName, props, this.props.children)
}
}
}
const options = {
remarkReactComponents: {
td: createTableCellComponent('td'),
th: createTableCellComponent('th')
}
}
const processor = remark().use(remarkReact, options) |
@tmcw Any thoughts on this?
|
I lean toward inline styles here - if we required a stylesheet for remark-react's output to be viewed correctly, I doubt many would include it. And GFM supports table alignment, so it seems like a complete implementation should include it. |
I am running up against this issue creating email templates using React. Unfortunately I need to use many |
Hey folks! I try’d my hand at this after GH-32, by using I think it would be simplest to have a component handle this instead, something like remark-react-lowlight. @noradaiko Would you be interested in creating something like that? (or maybe someone else?) |
Do you mean that having a separate component from remark-react for it is good idea? I think it's better to have a default Thanks! |
@noradaiko I think you’re right! I just pushed to GH-32 to use |
Excellent! |
React ignores
align
property since this property is obsolete in HTML5.align
is not listed as supported attribute: https://facebook.github.io/react/docs/tags-and-attributes.htmlIt should use CSS instead.
The text was updated successfully, but these errors were encountered: