سؤال

ما زلت في منتصف ترميز مشروعي العام الأخير في الجامعة، واجهت مشكلة حيث أحتاج إما تحويلها من HTML إلى علامة أو تأشيرة Versa.الآن ليس لدي أي تجربة على الإطلاق من بيرل، بيثون، إلخ. لذلك أنا بحاجة إلى حل سهل التنفيذ، ليس لدي سوى حوالي 6 أسابيع اليسار لإكمال هذا الآن.أنا أكتب البيانات من مربع نص WMD إلى SQL Server، وأستطيع إما تحميلها كمسافة تخفيض أو أتش تي أم أل، لكن إذا كانت تلك البيانات تحتاج إلى تحرير، فلا يمكن أن يكون هذا في 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:

  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