Skip to content

Commit

Permalink
add tables extention and VIMWIKI_MARKDOWN_EXTENSIONS
Browse files Browse the repository at this point in the history
  • Loading branch information
WnP committed Sep 17, 2019
1 parent 15bcbf7 commit 7fe889c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,18 @@ let g:vimwiki_list = [{
\ 'template_ext': '.tpl'}]
```

## Markdown extensions

The following [markdown extensions](https://python-markdown.github.io/extensions/)
are activated by default:

- [fenced_code](https://python-markdown.github.io/extensions/fenced_code_blocks/)
- [tables](https://python-markdown.github.io/extensions/tables/)
- [CodeHilite](https://python-markdown.github.io/extensions/code_hilite/)

But you can add more extensions using `VIMWIKI_MARKDOWN_EXTENSIONS` environment
variable, which is a coma separated list of extensions.

## Syntax highlighting

Syntax highlighting is provided by [Pygments](http://pygments.org/), which will
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"vimwiki markdown file to html with syntax highlighting.",
long_description=long_description,
long_description_content_type="text/markdown",
version="0.1.1",
version="0.2.0",
py_modules=["vimwiki_markdown"],
packages=[],
package_data={},
Expand Down
6 changes: 5 additions & 1 deletion vimwiki_markdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,12 @@ def main():
filename, _ = os.path.splitext(os.path.basename(INPUT_FILE))
output_file = os.path.join(OUTPUT_DIR, filename + ".html")

extensions = ["fenced_code", "tables"]
extensions += os.getenv("VIMWIKI_MARKDOWN_EXTENSIONS", "").split(",")
extensions = set([e for e in extensions if e] + [CodeHiliteExtension()])

# Setup markdown parser
md = markdown.Markdown(extensions=["fenced_code", CodeHiliteExtension()])
md = markdown.Markdown(extensions=extensions)
md.inlinePatterns.deregister("link")
md.inlinePatterns.register(
LinkInlineProcessor(markdown.inlinepatterns.LINK_RE, md), "link", 160
Expand Down

0 comments on commit 7fe889c

Please sign in to comment.