-
Notifications
You must be signed in to change notification settings - Fork 182
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
Broken tables #618
Comments
Thank you for spending time to document this. It is extremely useful. I think parsing of markdown for table cells is probably going to be best handled by a 3rd party. I'll report back with a favoured approach shortly. |
Half-assed solution could be to defensively remove line-breaks from any cell contents. The case of missing description in the index table is most puzzling though - it doesn't seem to fall into the same pattern as others. And I'm not sure what makes that one description special from others. |
@KillyMXI I think rather than trying to parse the markdown to html in the table cell it might be a better to provide an option to wrap the markdown in an html table as follows: Inputexport type Token = {
// ...
/**
* The length of the matched substring.
*
* _(Might be different from the text length in case replace value
* was used in a {@link RegexRule}.)_
*/
len: number;
// ...
} format="table"Will create a markdown table and remove all linebreaks from the comments. This will work for short descriptions or if html is being used for block elements. ## Type declaration
| Member | Type | Description |
| :------ | :------ | :------ |
| `len` | `number` | The length of the matched substring. _(Might be different from the text length in case replace value was used in a [RegexRule](../interfaces/RegexRule.md).)_ | format="htmlTable"Rather than trying to parse the markdown to html we simply wrap the markdown in an html table. This also means that users will be able to render triple line code blocks in the same way as outside of table cells. ## Type declaration
<table><tr><th>Member</th><th>Type</th><th>Description</th></tr><tr><td>
`len`
</td><td>
`number`
</td><td>
The length of the matched substring.
_(Might be different from the text length in case replace value
was used in a [RegexRule](../interfaces/RegexRule.md).)_
</td></tr></table> I would be interested to know your thoughts? |
I love this idea! One note though: with |
As discussed, |
Thank you. Trying it now. First thing I tripped on: So I'm limited to either What I wish is that it would be possible to have another option for index - get the first paragraph, trim all line breaks in it. So I can have the right balance of the level of details. |
Where |
Will update so also supported for index.
Happy to look at this. Can you provide a specific example so I don't implement the wrong thing? |
These two were mentioned in the issue above: /**
* Lexing rule.
*
* Base rule looks for exact match by it's name.
*
* If the name and the lookup string have to be different
* then specify `str` property as defined in {@link StringRule}.
*/
export interface Rule {
// ...
} Desirable index description: /**
* String rule - looks for exact string match that
* can be different from the name of the rule.
*/
export interface StringRule extends Rule {
// ...
} Desirable index description: This is another one: /**
* Non-empty array of rules.
*
* Rules are processed in provided order, first match is taken.
*
* Rules can have the same name. For example, you can have
* separate rules for various keywords and use the same name "keyword".
*/
export type Rules = [
//...
]; Desirable index description: Previously mentioned issue of missing description is now fixed, that's nice. |
hmm |
Sorry - the option was exposed but the logic wasn't merged into the release. It will go into 4.1.2. |
All issues in this ticket should be fixed in typedoc-plugin-markdown@4.1.2 |
sigh What I currently see in index for <tr>
<td>
[Rules](type-aliases/Rules.md)
</td>
<td>
Non-empty array of rules. Rules are processed in provided order, first match is taken. Rules can have the same name. For example, you can have separate rules for various keywords and use the same name "keyword".
</td>
</tr> Expectation for Currently, it hurts readability of both raw and processed output with There might also be some misunderstanding - I was expecting at least a comment after #618 (comment) , and it should be attributed to |
I have set up a demo repo with this issue: https://github.com/typedoc2md/typedoc-plugin-markdown-scratchpad/tree/main/issues/618 As you can see this output matches your highlighted comments.
I have just discovered that your observed behaviour is confined to Windows OS - i'll have to fix it with next release (sorry). If you think I have misunderstood anything else let me know. |
I need to clarify once again, that the combination of my desirable behavior and
Thus, I see the content of the demo repo as a result of miscommunication. I should've made more clear that the desirable index description is not linked to html. |
Yes i understand. |
You have also alluded to providing a separate option of what should be displayed in the table column for indexes which might also be a good idea. (First para or complete summary etc). |
Expectation for <tr>
<td>
[Rules](type-aliases/Rules.md)
</td>
<td>
Non-empty array of rules.
Rules are processed in provided order, first match is taken.
Rules can have the same name. For example, you can have
separate rules for various keywords and use the same name "keyword".
</td>
</tr> Desirable separate option: index table with the description that is cut down to first paragraph.
|
thank you. I think for now (and for simplicity):
Any other configurations i'll wait to see if there is any community feedback / requests. |
typedoc-plugin-markdown@4.2.0 will now work as above. See demo repo - https://github.com/typedoc2md/typedoc-plugin-markdown-scratchpad/tree/main/issues/618. |
Nice. But now the bug of missing description in the index is back. /**
* Create a lexer function.
*
* @param rules - Non-empty array of lexing rules.
*
* Rules are processed in provided order, first match is taken.
*
* Rules can have the same name - you can have separate rules
* for keywords and use the same name "keyword" for example.
*
* @param options - Lexer options object.
*/
export function createLexer (
rules: Rules,
options?: Options
): Lexer; I got hyphen both with ## Functions
| Function | Description |
| ------ | ------ |
| [createLexer](functions/createLexer.md) | - |
## Functions
<table>
<tr>
<th>Function</th>
<th>Description</th>
</tr>
<tr>
<td>
[createLexer](functions/createLexer.md)
</td>
<td>
‐
</td>
</tr>
</table> Expected description: |
typedoc-plugin-markdown@4.2.1 . fingers crossed :) https://github.com/typedoc2md/typedoc-plugin-markdown-scratchpad/tree/main/issues/618 |
Yay! All seems to work, no more broken tables, and I can have perfect index. |
What package is the bug related to?
typedoc-plugin-markdown
Describe the issue
Related to #615
Issues I notice with table formatting, in version 4.0.2.
Interface members, unexpected line-breaks
Type alias, unexpected line-break
Function parameters, unexpected line-break
Index, missing description
(expected "Lexer function." in the description column)
Index, unexpected line-break
Index, description trimmed at line-break, no full paragraph, no ellipsis
(expected "String rule - looks for exact string match that can be different from the name of the rule." in the description column)
(there is an unexpected line-break instead)
TypeDoc configuration
Expected behavior
No response
The text was updated successfully, but these errors were encountered: