freeflowuniverse / crystallib

Apache License 2.0
8 stars 4 forks source link

hero mdnook include does not work in tables and prints different strings #409

Open Mik-TF opened 2 months ago

Mik-TF commented 2 months ago

Situation

Example

Include in table

Description Value
TFT Market Price !!wiki.include page:'manual:tft_value.md' USD
TFT Market Cap !!wiki.include page:'manual:tft_marketcap.md' USD

!!wiki.include page:'manual:tft_value.md' USD

!!wiki.include page:'manual:tft_marketcap.md'

- converted to this

TFT Marketcap and Market Price

The TFT market price and marketcap are as follows:

Description Value
TFT Market Price !!wiki.include page:'manual:tft_value.md' USD
TFT Market Cap !!wiki.include page:'manual:tft_marketcap.md' USD
  1. 026

20280000 The market cap is equal to the product of the TFT market price and the circulating supply.

- output
![image](https://github.com/freeflowuniverse/crystallib/assets/77026219/f2263f7f-327d-485c-9e03-ec6b4a034928)

## Include changes output

- include changes the output, the following in a file

0.026

- becomes this (add a space)
  1. 026

example files content in info_tfgrid

image

image

examples files after conversion (hero/var/mdbuild/manual/src/manual

image

image

Mik-TF commented 2 months ago

@despiegk @MarioBassem

This issue is a priority, IMO.

MarioBassem commented 2 months ago

i tried to trace this, here is what i found:

  1. the output change issue is indeed a bug, a small fix is possible
  2. the include in a table problem is not so simple, here is why:
    • the markdown parser has top level elements: list, table, action, html, codeblock, and paragraph
    • lists and tables are actually parsed as paragraphs
    • a paragraph could be parsed to a combination of these elements: def, comment, link, or text
    • this means that a table cannot contain an action element (an include is an action element)

that being said, i believe some refactoring in the parser should be done to allow having nested element properly. @despiegk what do you think?

Mik-TF commented 2 months ago

"the output change issue is indeed a bug, a small fix is possible"

Fixing the output would be nice then, if it's a small fix.

@MarioBassem So I could simply set a definition or text instead of a whole page and it would work? I only want a number really (e.g. 0.022 as the TFT price). So including the page is not necessary.

What would be the include here? Something like this?

!!wiki.include text:'manual:tft_value.md' Perharps it's easier to set the numbers as def? Thanks!

despiegk commented 1 month ago

its quite a serious amount of work to make this feature work, will think how to do it best

Mik-TF commented 1 month ago

Ok good. For now I put static content instead in the manual.