retext-project / retext

ReText: Simple but powerful editor for Markdown and reStructuredText
GNU General Public License v2.0
1.86k stars 198 forks source link

support extended markdown? #243

Open retsyo opened 7 years ago

retsyo commented 7 years ago

I found an online md editor, https://www.zybuluo.com/mdeditor which needs some time to load fully, and is in Chinese I found some feature is nice. Does any plugin support them in retext?

  1. [ ] and [x] will be rendered as check box
  2. in table, "-----:" lets item right-aligned, ":-----" left-aligned, ":-----:" middle-aligned
  3. flowchart, Gantt chart and so on
mitya57 commented 7 years ago

Hi,

I can recommend you to look at pymdown-extensions pack by @facelessuser. In particular,

I cannot say anything about the table items aligning — perhaps you might try to write your own extension for this :)

See also this wiki page for the documentation on how to load extensions.

retsyo commented 7 years ago

thanks. However, I have read but still be puzzled. Is there any instruction for a user but not a coder? I mean, 1. download something from some url, then put it under which directory; 2. how to enable the extension in retext

p.s. I have installed PyMdown Extensions via "pip install pymdown-extensions", which says "Successfully installed Markdown-2.6.7 pymdown-extensions-1.1", there is still no tasklist, code highlight

import re
# more python code
import re

[ ]a

[x]a

mitya57 commented 7 years ago

Hi,

Installing

This highly depends on your system (which you did not mention). Usually, pip is the command to install packages for Python 2, and for ReText you need pip3 command (which will install for Python 3). So, the correct command will be:

$ pip3 install --user pymdown-extensions

Using the extensions

Python-Markdown (and ReText) requires the module name, which can be imported from Python. In example, for the Tasklist extension it will be pymdownx.tasklist (because that extension is installed into site-packages/pymdownx/tasklist.py file).

That said, the following piece of Markdown works for me:

<!-- Required extensions: pymdownx.tasklist -->

- [ ] item 1
- [x] item 2

You can also put these extension names into the Preferences dialog so that they are applied globally. After doing this, open a new tab, because the change does not affect the existing tabs.

dessalines commented 6 years ago

I really like how these modules are pluggable, but I'd definitely vote for tasklist to be bundled by default.

mitya57 commented 6 years ago

I do not want to bundle anything, but maybe there will be a better interface to discover and install extensions in future versions.

JamesStallings commented 3 years ago

I cannot get any extensions to work at all.

mitya57 commented 3 years ago

@JamesStallings What exact extension you tried to use, and what steps did you do that failed to work? Have you read the wiki page about Markdown extensions?

JamesStallings commented 3 years ago

@mitya57 thanks for the reply, I have tried to use 3rd party checklist and third party caption.

mitya57 commented 3 years ago

Please explain what you did, to allow me to help you.

In this thread (https://github.com/retext-project/retext/issues/243#issuecomment-249485790) there are steps to set up tasklist extension. Was the package installed successfully? What are the contents of your Markdown file? What output do you get with it?