Нужно было найти решение отображения файлов *.md напрямую, плюс нужна была поддержка синтаксиса этого формата файлов. Решение под катом.
Сварганил свой плагин, который решает задачу отображения Markdown файлов и подсветку синтаксиса.
Найти плагин можно по следующим ссылкам:
- https://github.com/Harrix/Harrix-MarkdownFile/releases/
- https://wordpress.org/plugins/harrix-markdownfile/
Данный плагин добавляет шорткод, с помощью которого добавляется Markdown файл:
1 |
[markdown-file][/markdown-file] |
Например:
1 |
[markdown-file]https://raw.github.com/Harrix/Harrix-MarkdownFile/master/README.md[/markdown-file] |
И под горизонтальной чертой будет отображен Markdown файл по вышеприведенному коду:
english | русский
Harrix MarkdownFile
Version 1.2
Worpress plugin. Display Markdown files with syntax highlighting in Wordpress.
The latest version of the plugin can be found here:
- https://github.com/Harrix/Harrix-MarkdownFile/releases/
- https://wordpress.org/plugins/harrix-markdownfile/
License: MIT.
Demo: http://blog.harrix.org/?p=1336
Usage
[markdown-file][/markdown-file]
This shortcode embeds markdown file by url.
[markdown-file]https://raw.github.com/Harrix/HarrixQtLibrary/master/README.md[/markdown-file]
Libraries
The plugin uses the libraries:
- parsedown: http://parsedown.org/
- highlight.js: https://highlightjs.org/
History
A detailed list of changes in the file CHANGELOG.md.
Contacts
Author: Sergienko Anton
The author can be contacted at sergienkoanton@mail.ru or http://vk.com/harrix.
Site of the author, which publishes the latest news: http://blog.harrix.org, and the projects are located at: http://harrix.org.