multilingual-markdown icon indicating copy to clipboard operation
multilingual-markdown copied to clipboard

Support Jupyter Notebook(.ipynb)

Open darwintree opened this issue 3 years ago • 3 comments

Is your feature request related to a problem? Please describe. Currently, only .md files are supported. Jupyter Notebooks(.ipynb) are not supported.

Describe the solution you'd like A .ipynb file is a json file containing code cells and markdown cells. At present, applying the parsing rules to markdown cells could provide this feature.

Describe alternatives you've considered Decomposing the logic of MultilingualDoc and provide a convert API would also help. Imagine the API convert:

# raw markdown text
raw_markdown:str = open(path_to_md) 

# converted texts
converted_markdowns: List[str] = convert(raw_markdown)

for txt in converted_markdowns:
    save(txt)

If this API is provided, it would be convenient for others to provide support to other file format

Additional context It would be better if the convert could apply to ipynb's code part.

darwintree avatar Nov 08 '22 04:11 darwintree

Thank you for your great suggestion.

1. Jupyter Notebook support (.ipynb) I hadn't considered Jupyter Notebooks at all, but they look useful. In the next coming version, I will add a feature for the cells of "cell_type": "markdown" in .ipynb files.

2. Python API for the mmg I agree with you that we need a simple API. I'll add it in the next version.

3. Code cell support in Jupyter I'm sorry, I didn't understand how you want to use the converting function on Code cells. Could you give me examples or describe it in more detail?

ryul1206 avatar Nov 08 '22 15:11 ryul1206

Thank you for your great suggestion.

1. Jupyter Notebook support (.ipynb) I hadn't considered Jupyter Notebooks at all, but they look useful. In the next coming version, I will add a feature for the cells of "cell_type": "markdown" in .ipynb files.

2. Python API for the mmg I agree with you that we need a simple API. I'll add it in the next version.

3. Code cell support in Jupyter I'm sorry, I didn't understand how you want to use the converting function on Code cells. Could you give me examples or describe it in more detail?

Thank you for your reply. For the code cell part, I mean there are often situations comments are needed to explain the code in detail. And it would be better if the multilingual feature could apply to the comments. The following code example explains the situation that I might want to translate "initialize the settings" to other languages

# initialize the settings
init() 

darwintree avatar Nov 08 '22 15:11 darwintree

Thanks, now I understand. :) 👍 It would be great if people could use mmg in code cells. However, we need some discussion to define the proper usage rules because various complex situations are possible. Since the code cell will call a program logic, the section keyword must be written as a comment. And a comment can also be on the same line as the code. Furthermore, I've seen someone use other languages like C++ in Jupyter... 😭 It is possible to put restrictions on user environments, but this may increase the complexity of user understanding.

ryul1206 avatar Nov 08 '22 16:11 ryul1206