{"action":"created","issue":{"url":"https://api.github.com/repos/PHPOffice/PHPWord/issues/543","labels_url":"https://api.github.com/repos/PHPOffice/PHPWord/issues/543/labels{/name}","comments_url":"https://api.github.com/repos/PHPOffice/PHPWord/issues/543/comments","events_url":"https://api.github.com/repos/PHPOffice/PHPWord/issues/543/events","html_url":"https://github.com/PHPOffice/PHPWord/issues/543","id":85101983,"number":543,"title":"Html to Docx issues","user":{"login":"patrickbrouwers","id":7728097,"avatar_url":"https://avatars.githubusercontent.com/u/7728097?v=3","gravatar_id":"","url":"https://api.github.com/users/patrickbrouwers","html_url":"https://github.com/patrickbrouwers","followers_url":"https://api.github.com/users/patrickbrouwers/followers","following_url":"https://api.github.com/users/patrickbrouwers/following{/other_user}","gists_url":"https://api.github.com/users/patrickbrouwers/gists{/gist_id}","starred_url":"https://api.github.com/users/patrickbrouwers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/patrickbrouwers/subscriptions","organizations_url":"https://api.github.com/users/patrickbrouwers/orgs","repos_url":"https://api.github.com/users/patrickbrouwers/repos","events_url":"https://api.github.com/users/patrickbrouwers/events{/privacy}","received_events_url":"https://api.github.com/users/patrickbrouwers/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-06-04T13:35:09Z","updated_at":"2015-10-29T14:37:50Z","closed_at":null,"body":"Thanks for this great package!\r\n\r\nI'm having issues converting html to docx. \r\n\r\nI get user input in Markdown and convert this to html with https://github.com/thephpleague/commonmark \r\n\r\nInput:\r\n```\r\ntext\r\ntext\r\n\r\ntext\r\ntext\r\n```\r\n\r\nGets converted to:\r\n```\r\n<p>text\r\ntext</p>\r\n\r\n<p>text\r\ntext</p>\r\n```\r\n\r\nIn the Word-document it will look like:\r\n```\r\ntext text\r\ntext text\r\n```\r\n\r\nThis behaviour seems logical when I read the code. All linebreaks get deleted and html linebreaks (`<br />` get ignored). \r\n\r\nBy adding a method that parses the br's (I added with nl2br), it works just like I would expect.\r\n\r\nI'm wondering if this is the best way of handling it (and if this could be added to the package) or if there's a better way of handling it?\r\n\r\nAny help would be appreciated. Happy to make a pull request if needed."},"comment":{"url":"https://api.github.com/repos/PHPOffice/PHPWord/issues/comments/152199931","html_url":"https://github.com/PHPOffice/PHPWord/issues/543#issuecomment-152199931","issue_url":"https://api.github.com/repos/PHPOffice/PHPWord/issues/543","id":152199931,"user":{"login":"patrickbrouwers","id":7728097,"avatar_url":"https://avatars.githubusercontent.com/u/7728097?v=3","gravatar_id":"","url":"https://api.github.com/users/patrickbrouwers","html_url":"https://github.com/patrickbrouwers","followers_url":"https://api.github.com/users/patrickbrouwers/followers","following_url":"https://api.github.com/users/patrickbrouwers/following{/other_user}","gists_url":"https://api.github.com/users/patrickbrouwers/gists{/gist_id}","starred_url":"https://api.github.com/users/patrickbrouwers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/patrickbrouwers/subscriptions","organizations_url":"https://api.github.com/users/patrickbrouwers/orgs","repos_url":"https://api.github.com/users/patrickbrouwers/repos","events_url":"https://api.github.com/users/patrickbrouwers/events{/privacy}","received_events_url":"https://api.github.com/users/patrickbrouwers/received_events","type":"User","site_admin":false},"created_at":"2015-10-29T14:37:50Z","updated_at":"2015-10-29T14:37:50Z","body":"In the meantime I found out that (for my use case) this is the best solution:\r\n\r\n```\r\n/**\r\n     * Parse paragraph node\r\n     *\r\n     * @param \\DOMNode $node\r\n     * @param \\PhpOffice\\PhpWord\\Element\\AbstractContainer $element\r\n     * @param array &$styles\r\n     * @return \\PhpOffice\\PhpWord\\Element\\TextRun\r\n     */\r\n    private static function parseParagraph($node, $element, &$styles)\r\n    {\r\n        $styles['paragraph'] = self::parseInlineStyle($node, $styles['paragraph']);\r\n        $newElement = $element->addTextRun($styles['paragraph']);\r\n        $newElement->addTextBreak(1);\r\n\r\n        return $newElement;\r\n    }\r\n```"}}