質問
私はまだ大学で私の最終年プロジェクトをコーディングすることの途中で、私はHTMLからマークダウンまたはビザ逆に変換する必要がある問題に出会いました。今私はPerl、Pythonなどの何でも経験がありませんので、実装の簡単なソリューションが必要です。これを完了するには約6週間しか残っていません。私はWMDテキストボックスからSQL Serverにデータを書きます、そして、私はそれをMarkDownまたはHTMLとしてアップロードすることができますが、そのデータが編集する必要がある場合はHTMLになることはできません。ゼロ/非常に小さなコンピューティングがある「知っている」
私は何をすべきか?
解決
Karmastan's answer is probably the best here. Keeping the raw Markdown in the database is a really good solution as it allows users to upkeep the content in a form with which they're familiar.
However, if you have a bunch of HTML which is already converted, you might want to look at something like Markdownify: The HTML to Markdown converter for PHP.
Edit: based on what you've said below, there are a few things you should keep in mind:
Make sure that the following is set in
wmd.js
:wmd_options = {"output": "Markdown"};
This ensures that you're storing Markdown in the database.
When outputting the Markdown to the web, you need to transform it to HTML. To do this, you'll need a library which does Markdown -> HTML conversion. Here are two examples:
I'm not a .NET developer, so I can't really help with how these libraries should be used, but hopefully the documentation will make that clear.
他のヒント
If you look at the web site for Markdown, you'll find a Perl script that converts Markdown-syntax documents to HTML. Keep Markdown text in your database and invoke the script whenever you need to display the text. No Perl knowledge required!