문제

나는 아직도 대학에서 마지막 해 프로젝트를 코딩하는 중간에 있고, HTML에서 Markdown 또는 Visa도 마찬가지로 변환 해야하는 문제를 가로갔습니다.이제는 Perl, Python 등의 경험이 없으므로 구현하기 쉬운 솔루션이 필요합니다. 이제는 약 6 주 남았습니다.WMD 텍스트 상자에서 SQL Server에 데이터를 쓰고 Markdown 또는 HTML로 업로드 할 수 있지만 해당 데이터가 편집 해야하는 경우 HTML에서도 수정할 수 없을수록 최종 사용자가 지각되는 최종 사용자에게 너무 혼란 스러울 수 없을 것입니다.0 / 거의 계산 된 컴퓨팅이 있음 "방법"을 알고 있습니다.

어떻게해야합니까?

도움이 되었습니까?

해결책

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:

  1. Make sure that the following is set in wmd.js:

    wmd_options = {"output": "Markdown"};

    This ensures that you're storing Markdown in the database.

    Source: How do you store the markdown using WMD in ASP.NET?

  2. 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!

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top