Pregunta

Todavía estoy en medio de la codificación de mi proyecto de último año en la universidad, y he encontrado un problema en el que necesito convertirme de HTML a Markdown o Visa VERSA.Ahora no tengo experiencia en absoluto de Perl, Python, etc., por lo que necesito una solución fácil de implementar, solo queda aproximadamente 6 semanas para completar esto ahora.Estoy escribiendo los datos de un cuadro de texto WMD a SQL Server, y puedo cargarlo como Markdown o HTML, pero si es necesario editarlo, no puede estar en HTML, ya que esto sería demasiado confuso para el usuario final que se percibe atener cero / muy poca computación "saber como".

¿Qué debo hacer?

¿Fue útil?

Solución

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.

Otros consejos

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!

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top