[英]Reverse engineer string formarting process
我正在為我的所見即所得數據輸入組件使用 slate-react 編輯器,該組件將顯示在 Telegram 上。
然后按照 Telegram 的要求對文本輸入進行格式化,如本例所示:
Slate Object
[
{
"type": "paragraph",
"children": [
{
"text": "Dry grains to moisture content of below 12 percent and dress with crop "
},
{
"text": "protection ",
"bold": true
},
{
"text": "products such as Actellic 2%. Seeds meant for planting should not be stored for more than six "
},
{
"text": "months",
"underline": true
},
{
"text": ". For more "
},
{
"text": "information",
"underline": true
},
{
"text": ", please contact your "
},
{
"text": "local ",
"italic": true
},
{
"text": "Extension Agent."
}
]
}
]
然后我將字符串格式化為 Telegram 規范,如下所示:
Dry grains to moisture content of below 12 percent and dress with crop **protection **products such as Actellic 2%. Seeds meant for planting should not be stored for more than six months. For more information, please contact your _local _Extension Agent.
我現在想對該過程進行逆向工程,以便如果給定這樣的字符串,我可以生成上面的 object,以便我能夠在編輯器上顯示它。 我想幫助制定能夠達到預期結果的 function。
對於將來可能需要此類信息的人,感謝@Phil,我從評論中獲得了指針,我能夠在網上搜索 markdown 標記器。 Prismjs 就像一個魅力。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.