Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tables are not supported #15

Open
qwsdxcqwsdxc opened this issue Dec 18, 2018 · 2 comments
Open

Tables are not supported #15

qwsdxcqwsdxc opened this issue Dec 18, 2018 · 2 comments

Comments

@qwsdxcqwsdxc
Copy link

qwsdxcqwsdxc commented Dec 18, 2018

The code is :
let markdownString = ""
Colons can be used to align columns.
| Tables | Are | Cool |
| ------------- |:-------------:| -----:|
| col 3 is | right-aligned | $1600 |
| col 2 is | centered | $12 |
| zebra stripes | are neat | $1 |
The outer pipes (|) are optional, and you don't need to make the
raw Markdown line up prettily. You can also use inline Markdown.

    Markdown | Less | Pretty
    --- | --- | ---
    *Still* | `renders` | **nicely**
    1 | 2 | 3
    1. First ordered list item
    2. Another item
    ⋅⋅* Unordered sub-list.
    1. Actual numbers don't matter, just that it's a number
    2. Ordered sub-list
    3. And another item.

    To have a line break without a paragraph, you will need to use two trailing spaces.⋅⋅
    Note that this line is separate, but within the same paragraph.⋅⋅
    (This is contrary to the typical GFM line break behaviour, where trailing spaces are not required.)

    * Unordered list can use asterisks
    - Or minuses
    + Or pluses

""
var style = DefaultStyle()
let finalText = doc.attributedText(style: style)
sampleTextView.attributedText = finalText

Table view is not supported also new line after every item in an ordered/unordered list is not rendering at all, instead all are displayed as a single paragraph . Please help !

@KristopherGBaker
Copy link
Owner

Tables are not currently supported for the attributedText method, but they are supported by the parser. It might be possible to add support for macOS by using NSTextTable, but that is not supported on iOS.

If you need to support tables, you may want to try https://github.com/KristopherGBaker/TexturedMaaku if your target is iOS, or you can build your own renderer if your target is not iOS or you don't want to use Texture (you can still use TexturedMaaku as an example), or find another library that suits your needs better.

You can also try using CMDocument instead of Document, use the renderHtml method to get an html string, then create an NSAttributedString from that (but you won't have as much control over the styling and it might be slow).

I hope to look more into the table issue when I have time, but that may be a while.

Example using TexturedMaaku
simulator screen shot - iphone xr - 2018-12-19 at 23 21 44

@qwsdxcqwsdxc
Copy link
Author

Thanks for the reply

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants