├── .circleci └── config.yml ├── .editorconfig ├── .github ├── ISSUE_TEMPLATE.md ├── ISSUE_TEMPLATE │ ├── NEW_FEATURE_REQUEST.md │ └── REPRODUCIBLE_BUG_REPORT.md └── PULL_REQUEST_TEMPLATE.md ├── .gitignore ├── .php_cs.dist ├── .plugin_includes ├── CONTRIBUTING.md ├── LICENSE.Apache-2.0 ├── LICENSE.GPL-2.0-or-later ├── LICENSE.txt ├── Makefile ├── README.md ├── assets ├── sample-page.txt └── screenshot.png ├── composer.json ├── composer.lock ├── conf ├── default.php └── metadata.php ├── docker-compose.yml ├── lang ├── en │ ├── lang.php │ └── settings.php └── ja │ ├── lang.php │ └── settings.php ├── phpunit.xml.dist ├── plugin.info.txt ├── scripts ├── archive.bash ├── copy-to-docker-volume.bash └── push-release-tag.bash ├── src ├── DokuWiki │ └── Plugin │ │ └── Mdpage │ │ ├── Markdown.php │ │ ├── Markdown │ │ ├── GitHubFlavored.php │ │ ├── MarkdownExtra.php │ │ └── Traditional.php │ │ └── MarkdownRendererTrait.php └── bootstrap.php ├── syntax.php └── tests ├── DokuWiki └── Test │ └── Plugin │ └── Mdpage │ └── MarkdownSpecTest.php ├── bootstrap.php └── specs ├── cannot-lookup-ref ├── Content.md ├── Content_GFM.html ├── Content_MarkdownExtra.html └── Content_Traditional.html ├── dokuwiki-internal ├── Content.md ├── Content_GFM.html ├── Content_MarkdownExtra.html └── Content_Traditional.html ├── features ├── Content.md ├── Content_GFM.html ├── Content_MarkdownExtra.html └── Content_Traditional.html ├── htmlok ├── Content.md ├── Content_GFM.html ├── Content_MarkdownExtra.html └── Content_Traditional.html ├── issue-24 ├── Content.md ├── Content_GFM.html ├── Content_MarkdownExtra.html └── Content_Traditional.html ├── issue-35 ├── Content.md ├── Content_GFM.html ├── Content_MarkdownExtra.html └── Content_Traditional.html ├── issue-40 ├── Content.md ├── Content_GFM.html ├── Content_MarkdownExtra.html └── Content_Traditional.html ├── issue-50 ├── Content.md ├── Content_GFM.html ├── Content_MarkdownExtra.html └── Content_Traditional.html ├── metadata ├── Content.md └── Content_GFM.meta.txt └── without-htmlok ├── Content.md ├── Content_GFM.html ├── Content_MarkdownExtra.html └── Content_Traditional.html /.circleci/config.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | 3 | jobs: 4 | build: 5 | docker: 6 | - image: circleci/php:7.3-node-browsers 7 | steps: 8 | - checkout 9 | 10 | - run: sudo composer self-update 11 | 12 | - run: make 13 | - run: mkdir -p /tmp/artifacts 14 | - run: cp archive.tar.gz /tmp/artifacts/plugin-package.tar.gz 15 | 16 | - persist_to_workspace: 17 | root: /tmp/artifacts 18 | paths: 19 | - plugin-package.tar.gz 20 | 21 | test: 22 | docker: 23 | - image: circleci/php:7.3-node-browsers 24 | steps: 25 | - checkout 26 | 27 | - run: sudo composer self-update 28 | 29 | - restore_cache: 30 | keys: 31 | - composer-v1-{{ checksum "composer.lock" }} 32 | # fallback to using the latest cache if no exact match is found (See https://circleci.com/docs/2.0/caching/) 33 | - composer-v1- 34 | - run: composer install --no-ansi --no-interaction --prefer-dist 35 | # `_test` directory of dokuwiki is not included by `--prefer-dist` (maybe, this is GitHub issue). 36 | # This is the fallback. 37 | - run: | 38 | if [ ! -d vendor/splitbrain/dokuwiki/_test ]; then 39 | rm -rf vendor/splitbrain/dokuwiki 40 | composer install --no-ansi --no-interaction --prefer-source 41 | fi 42 | - save_cache: 43 | key: composer-v1-{{ checksum "composer.lock" }} 44 | paths: 45 | - vendor 46 | 47 | - run: ./bin/php-cs-fixer fix --dry-run 48 | 49 | - run: | 50 | curl -o cc-test-reporter -sSL https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 51 | chmod +x ./cc-test-reporter 52 | 53 | - run: | 54 | sudo docker-php-ext-enable xdebug 55 | 56 | - run: | 57 | ./cc-test-reporter before-build 58 | phpdbg -qrr ./bin/phpunit --coverage-clover clover.xml 59 | ./cc-test-reporter after-build --exit-code $? \ 60 | --coverage-input-type clover 61 | 62 | docker-test: 63 | machine: true 64 | steps: 65 | - checkout 66 | 67 | - run: docker-compose build 68 | 69 | - restore_cache: 70 | keys: 71 | - composer-v1-{{ checksum "composer.lock" }} 72 | # fallback to using the latest cache if no exact match is found (See https://circleci.com/docs/2.0/caching/) 73 | - composer-v1- 74 | 75 | - run: | 76 | docker-compose up -d 77 | sleep 10 78 | 79 | - run: | 80 | ./scripts/copy-to-docker-volume.bash 81 | 82 | - run: | 83 | curl -v http://localhost:8080/doku.php?start | \ 84 | grep 'simple paragraph: emph, strong and mono.' 85 | 86 | - run: docker-compose down 87 | 88 | deploy: 89 | docker: 90 | - image: circleci/golang:1.13 91 | steps: 92 | - checkout 93 | 94 | - attach_workspace: 95 | at: /tmp/artifacts 96 | 97 | - run: go get github.com/tcnksm/ghr 98 | 99 | - run: | 100 | VERSION="${CIRCLE_TAG}" 101 | ghr \ 102 | -t ${GITHUB_TOKEN} \ 103 | -u ${CIRCLE_PROJECT_USERNAME} \ 104 | -r ${CIRCLE_PROJECT_REPONAME} \ 105 | -c ${CIRCLE_SHA1} \ 106 | -n "Release ${VERSION}" \ 107 | "${VERSION}" \ 108 | /tmp/artifacts 109 | 110 | - run: | 111 | VERSION="${CIRCLE_TAG}" 112 | git config user.email "release-bot@users.noreply.github.com" 113 | git config user.name "release-bot" 114 | git checkout release || git checkout -b release 115 | cp /tmp/artifacts/plugin-package.tar.gz . 116 | git add -f plugin-package.tar.gz 117 | git commit -m "Automatic release $VERSION" 118 | git remote add for-release \ 119 | "https://${GITHUB_TOKEN}@github.com/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}" 120 | git push -u for-release release 121 | 122 | workflows: 123 | version: 2 124 | test: 125 | jobs: 126 | - test: 127 | filters: 128 | branches: 129 | ignore: release 130 | - docker-test: 131 | requires: 132 | - test 133 | filters: 134 | branches: 135 | ignore: release 136 | build-and-deploy: 137 | jobs: 138 | - build: 139 | filters: 140 | branches: 141 | only: master 142 | tags: 143 | only: /.*/ 144 | - deploy: 145 | requires: 146 | - build 147 | filters: 148 | branches: 149 | ignore: /.*/ 150 | tags: 151 | only: /^v\d+\.\d+\.\d+$/ 152 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | end_of_line = lf 6 | indent_size = 4 7 | indent_style = space 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true 10 | 11 | [Makefile] 12 | indent_style = tab 13 | 14 | [*.md] 15 | trim_trailing_whitespace = false 16 | 17 | [tests/specs/**/*.{html,txt}] 18 | indent_style = tab 19 | trim_trailing_whitespace = false 20 | insert_final_newline = false 21 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | Please fill out one of the templates on: https://github.com/mizunashi-mana/dokuwiki-plugin-mdpage/issues/new/choose 2 | 3 | We will close issues asking questions or requesting changes without comment. 4 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/NEW_FEATURE_REQUEST.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: New Feature Request 3 | about: Request new feature you want 4 | 5 | --- 6 | 7 | This repository is abondoned. Issues will be left. 8 | 9 | 19 | 20 | **This is a feature request.** 21 | 22 | Specification: 23 | 24 | Motivations: 25 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/REPRODUCIBLE_BUG_REPORT.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Reproducible Bug Report 3 | about: Submit an issue so we can investigate 4 | 5 | --- 6 | 7 | This repository is abondoned. Issues will be left. 8 | 9 | 15 | 16 | **This is a bug report.** 17 | 18 | | Name | Value | 19 | | --- | --- | 20 | | DokuWiki Version | | 21 | | PHP Version | | 22 | | OS | | 23 | | Web Server | | 24 | 25 | Expect behavior: 26 | 27 | Actual behavior: 28 | 29 | Details: 30 | 31 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | - [ ] Have you followed the [guidelines for contributing](https://github.com/mizunashi-mana/dokuwiki-plugin-mdpage/blob/master/CONTRIBUTING.md)? 2 | - [ ] Have you checked that there aren't other open [pull requests](https://github.com/mizunashi-mana/dokuwiki-plugin-mdpage/pulls) for the same update/change? 3 | 4 | --- 5 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.tar.gz 2 | /coverage/ 3 | 4 | # for DokuWiki 5 | /manager.dat 6 | 7 | # for Composer 8 | /vendor/ 9 | /bin/ 10 | 11 | # for CS Fixer 12 | .php_cs.cache 13 | -------------------------------------------------------------------------------- /.php_cs.dist: -------------------------------------------------------------------------------- 1 | files() 5 | ->in(__DIR__.'/conf') 6 | ->in(__DIR__.'/lang') 7 | ->in(__DIR__.'/src') 8 | ->in(__DIR__.'/tests') 9 | ->name('*.php') 10 | ; 11 | 12 | return PhpCsFixer\Config::create() 13 | ->setFinder($finder) 14 | ->setRules([ 15 | '@Symfony' => true, 16 | 'yoda_style' => false, 17 | 'braces' => [ 18 | 'position_after_functions_and_oop_constructs' => 'same', 19 | ], 20 | 'phpdoc_summary' => false, 21 | ]) 22 | ; 23 | -------------------------------------------------------------------------------- /.plugin_includes: -------------------------------------------------------------------------------- 1 | conf 2 | lang 3 | src 4 | vendor 5 | README.md 6 | LICENSE.txt 7 | LICENSE.Apache-2.0 8 | LICENSE.GPL-2.0-or-later 9 | plugin.info.txt 10 | syntax.php 11 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing Guide 2 | 3 | Read the section for your purpose. 4 | 5 | ## Report a bug 6 | 7 | 1. Check FAQ on https://www.dokuwiki.org/plugin:mdpage#faq 8 | 2. Check known issues on https://github.com/mizunashi-mana/dokuwiki-plugin-mdpage/issues 9 | 3. [Open an issue](https://github.com/mizunashi-mana/dokuwiki-plugin-mdpage/issues/new) according to the template 10 | 11 | ## Contribute a fix 12 | 13 | 1. `composer install --prefer-source --dev` 14 | 2. `./bin/php-cs-fixer fix` 15 | 3. `composer test` and fix any failing tests 16 | 4. `git commit` with message 17 | 5. Open a pull request and fix any failing tests 18 | 19 | NOTICE: 20 | 21 | This plugin includes source codes of dependent libraries. 22 | When we add a new library to depend, we should check license compatibles. 23 | -------------------------------------------------------------------------------- /LICENSE.Apache-2.0: -------------------------------------------------------------------------------- 1 | Copyright 2018- Mizunashi Mana 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | -------------------------------------------------------------------------------- /LICENSE.GPL-2.0-or-later: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | 294 | Copyright (C) 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | , 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. 340 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Apache-2.0 OR GPL-2.0-or-later 2 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: build 2 | build: 3 | composer install \ 4 | --no-interaction \ 5 | --optimize-autoloader \ 6 | --no-dev --no-scripts --no-suggest 7 | ./scripts/archive.bash 8 | 9 | .PHONY: setup-dev 10 | setup-dev: 11 | composer install --prefer-source 12 | 13 | .PHONY: test 14 | test: 15 | composer test 16 | 17 | .PHONY: coverage 18 | coverage: 19 | composer test -- \ 20 | --coverage-clover coverage/clover.xml \ 21 | --coverage-html coverage/html 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Markdown plugin for DokuWiki 2 | 3 | [![CircleCI](https://circleci.com/gh/mizunashi-mana/dokuwiki-plugin-mdpage/tree/master.svg?style=svg)](https://circleci.com/gh/mizunashi-mana/dokuwiki-plugin-mdpage/tree/master) 4 | [![Maintainability](https://api.codeclimate.com/v1/badges/b43a73f03fca36f12742/maintainability)](https://codeclimate.com/github/mizunashi-mana/dokuwiki-plugin-mdpage/maintainability) 5 | [![Test Coverage](https://api.codeclimate.com/v1/badges/b43a73f03fca36f12742/test_coverage)](https://codeclimate.com/github/mizunashi-mana/dokuwiki-plugin-mdpage/test_coverage) 6 | 7 | **This plugin is abandoned. Only, PRs are welcome.** 8 | 9 | ## Installation / Usage 10 | 11 | See . 12 | 13 | ## Report a bug / Contribute a fix 14 | 15 | See [Contributing Guide](https://github.com/mizunashi-mana/dokuwiki-plugin-mdpage/blob/master/CONTRIBUTING.md). 16 | 17 | ## Release flow 18 | 19 | 1. Bump the date of `plugin.info.txt` 20 | 2. Run `./scripts/push-release-tag.bash [VERSION]` 21 | 3. Fix `lastupdate` on https://www.dokuwiki.org/plugin:mdpage 22 | 4. Wait deploying and update the release note for new version 23 | 24 | ## License 25 | 26 | This work is dual-licensed under [the Apache 2.0 License](https://github.com/mizunashi-mana/dokuwiki-plugin-mdpage/blob/master/LICENSE.Apache-2.0) and [the GPL 2.0 (or any later version)](https://github.com/mizunashi-mana/dokuwiki-plugin-mdpage/blob/master/LICENSE.GPL-2.0-or-later). 27 | You are free to pick which one suits your needs. 28 | 29 | * Using [cebe/markdown](https://github.com/cebe/markdown) to parse Markdown texts under [the MIT License](https://github.com/cebe/markdown/blob/master/LICENSE). 30 | 31 | Notice: DokuWiki is licensed under [the GPL 2.0](https://github.com/splitbrain/dokuwiki/blob/master/COPYING). This license cannot be compatible with the Apache 2.0 License and the GPL 3.0. See also: https://www.gnu.org/licenses/license-list.html . 32 | -------------------------------------------------------------------------------- /assets/sample-page.txt: -------------------------------------------------------------------------------- 1 | 2 | # Header 3 | 4 | 5 | 6 | simple paragraph: *emph*, **strong** and `mono`. 7 | 8 | inline html 9 |
You need to enable htmlok on DokuWiki configuration.
10 |
11 | 12 | > quote 13 | 14 | ``` 15 | code block 16 | ``` 17 | 18 | ---- 19 | 20 | [link](https://www.dokuwiki.org) 21 | 22 | [internal link](:start) 23 | 24 | ![image](https://secure.php.net/images/php.gif) 25 | 26 | ![internal image](:wiki:dokuwiki-128.png) 27 | 28 | * List 29 | - Sub item 1 30 | - Sub item 2 31 | * Item 2 32 | - Sub item 1 33 | 34 | 1. Ordered List 35 | - Sub item 1 36 | 2. Item 2 37 | - Sub item 1 38 |
39 | -------------------------------------------------------------------------------- /assets/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mizunashi-mana/dokuwiki-plugin-mdpage/e59d6ee8e895eb6f559cf3123b7d8935f929001e/assets/screenshot.png -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mizunashi-mana/dokuwiki-plugin-mdpage", 3 | "type": "dokuwiki-plugin", 4 | "description": "DokuWiki Markdown Plugin", 5 | "keywords": [ 6 | "dokuwiki", 7 | "plugin", 8 | "markdown" 9 | ], 10 | "license": [ 11 | "Apache-2.0", 12 | "GPL-2.0-or-later" 13 | ], 14 | "authors": [ 15 | { 16 | "name": "Mizunashi Mana", 17 | "email": "mizunashi-mana@noreply.git" 18 | } 19 | ], 20 | "config": { 21 | "bin-dir": "bin" 22 | }, 23 | "scripts": { 24 | "test": "phpunit", 25 | "lint-fix": "php-cs-fixer fix" 26 | }, 27 | "require": { 28 | "php": "^5.6 || ^7.0", 29 | "cebe/markdown": "^1.2", 30 | "symfony/polyfill-ctype": "^1.17" 31 | }, 32 | "require-dev": { 33 | "phpunit/phpunit": "^7.5", 34 | "splitbrain/dokuwiki": "dev-stable#release_stable_2020-07-29", 35 | "geshi/geshi": "@dev", 36 | "friendsofphp/php-cs-fixer": "^2.16" 37 | }, 38 | "autoload": { 39 | "psr-4": { 40 | "DokuWiki\\": "src/DokuWiki" 41 | } 42 | }, 43 | "autoload-dev": { 44 | "psr-4": { 45 | "Dokuwiki\\Test\\": "tests/DokuWiki/Test" 46 | } 47 | }, 48 | "repositories": [ 49 | { 50 | "type": "vcs", 51 | "url": "https://github.com/splitbrain/dokuwiki" 52 | }, 53 | { 54 | "type": "vcs", 55 | "url": "https://github.com/splitbrain/dokuwiki" 56 | } 57 | ] 58 | } 59 | -------------------------------------------------------------------------------- /conf/default.php: -------------------------------------------------------------------------------- 1 | 'security', 6 | ]; 7 | $meta['flavor'] = [ 8 | 'multichoice', 9 | '_choices' => [ 10 | 'traditional', 11 | 'github-flavored', 12 | 'markdown-extra', 13 | ], 14 | ]; 15 | $meta['markdown_default'] = [ 16 | 'onoff', 17 | ]; 18 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3' 2 | 3 | services: 4 | dokuwiki: 5 | image: bitnami/dokuwiki:20200729 6 | #image: bitnami/dokuwiki:20180422 7 | environment: 8 | DOKUWIKI_USERNAME: 'superuser' 9 | DOKUWIKI_PASSWORD: 'bitnami1' 10 | ports: 11 | - "8080:8080" 12 | # user/pass = user/bitnami1 13 | -------------------------------------------------------------------------------- /lang/en/lang.php: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | tests 13 | 14 | 15 | 16 | 17 | syntax.php 18 | src 19 | 20 | src/bootstrap.php 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /plugin.info.txt: -------------------------------------------------------------------------------- 1 | base mdpage 2 | author Mizunashi Mana 3 | email mizunashi@git.noreply 4 | date 2021-01-09 5 | name Markdown Page Plugin 6 | desc Write your own Markdown page 7 | url https://www.dokuwiki.org/plugin:mdpage 8 | -------------------------------------------------------------------------------- /scripts/archive.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | [[ "$DEBUG" = "true" ]] && set -x 4 | set -euo pipefail 5 | 6 | current_script_dir() { 7 | local source="${BASH_SOURCE[0]}" 8 | 9 | # resolve $source until the file is no longer a symlink 10 | if type -p readlink >/dev/null; then 11 | while [ -h "$source" ]; do 12 | local dir="$( cd -P "$( dirname "$source" )" >/dev/null && pwd )" 13 | local source="$(readlink "$source")" 14 | 15 | # if $source was a relative symlink, 16 | # we need to resolve it relative to the path where the symlink file was located 17 | if [[ "$source" != /* ]]; then 18 | local source="$dir/$source" 19 | fi 20 | done 21 | fi 22 | 23 | local dir="$( cd -P "$( dirname "$source" )" >/dev/null && pwd )" 24 | echo $dir 25 | } 26 | 27 | SCRIPT_DIR="$(current_script_dir)" 28 | 29 | if ! command -v tar >/dev/null 2>&1; then 30 | echo "Require 'tar' command" >&2 31 | exit 1 32 | fi 33 | 34 | TARGET_DIR="$(dirname "$SCRIPT_DIR")" 35 | 36 | tar \ 37 | -C $TARGET_DIR \ 38 | -zcvf archive.tar.gz \ 39 | $(cat "$TARGET_DIR/.plugin_includes") 40 | -------------------------------------------------------------------------------- /scripts/copy-to-docker-volume.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | [ "$DEBUG" = "true " ] && set -x 4 | set -euo pipefail 5 | 6 | CID="${CID:-"$(docker-compose ps -q)"}" 7 | if [ -z "$CID" ]; then 8 | echo "Cannot find docker containers. Plese exec 'docker-compose up -d'." >&2 9 | exit 1 10 | fi 11 | 12 | for cid_item in $CID; do 13 | docker cp . $cid_item:/bitnami/dokuwiki/lib/plugins/mdpage 14 | docker cp assets/sample-page.txt $cid_item:/bitnami/dokuwiki/data/pages/start.txt 15 | done 16 | -------------------------------------------------------------------------------- /scripts/push-release-tag.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | [[ "$DEBUG" = "true" ]] && set -x 4 | set -euo pipefail 5 | 6 | current_script_dir() { 7 | local source="${BASH_SOURCE[0]}" 8 | 9 | # resolve $source until the file is no longer a symlink 10 | if type -p readlink >/dev/null; then 11 | while [ -h "$source" ]; do 12 | local dir="$( cd -P "$( dirname "$source" )" >/dev/null && pwd )" 13 | local source="$(readlink "$source")" 14 | 15 | # if $source was a relative symlink, 16 | # we need to resolve it relative to the path where the symlink file was located 17 | if [[ "$source" != /* ]]; then 18 | local source="$dir/$source" 19 | fi 20 | done 21 | fi 22 | 23 | local dir="$( cd -P "$( dirname "$source" )" >/dev/null && pwd )" 24 | echo $dir 25 | } 26 | 27 | SCRIPT_DIR="$(current_script_dir)" 28 | 29 | if [ "$#" -lt 1 ] || [[ "$1" != [0-9]*.[0-9]*.[0-9]* ]]; then 30 | echo "Usage: $0 VERSION([0-9]+.[0-9]+.[0-9]+)" >&2 31 | exit 1 32 | fi 33 | 34 | if ! command -v git >/dev/null 2>&1; then 35 | echo "Require 'git' command" >&2 36 | exit 1 37 | fi 38 | 39 | TARGET_DIR="$(dirname "$SCRIPT_DIR")" 40 | if ! [ -d "$TARGET_DIR/.git" ]; then 41 | echo "Not git repository" >&2 42 | exit 1 43 | fi 44 | 45 | if [ "$(git rev-parse --abbrev-ref HEAD)" != "master" ]; then 46 | echo "Must checkout master branch." >&2 47 | exit 1 48 | fi 49 | 50 | if [ -z "${FORCE_RELEASE:-}" ]; then 51 | PLUGIN_DATE="$(git -C $TARGET_DIR show master:plugin.info.txt | grep 'date' | awk '{print $2}')" 52 | if [ "$PLUGIN_DATE" != "$(date +'%Y-%m-%d')" ]; then 53 | cat >&2 <&2 <parseOnce($content); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/DokuWiki/Plugin/Mdpage/Markdown/GitHubFlavored.php: -------------------------------------------------------------------------------- 1 | renderer = $renderer; 16 | $this->rendererData = $data; 17 | $this->rendererContext = $context; 18 | } 19 | 20 | protected function getDokuWikiVersion() { 21 | return $rendererContext['dokuwiki_version']; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/DokuWiki/Plugin/Mdpage/Markdown/MarkdownExtra.php: -------------------------------------------------------------------------------- 1 | renderer = $renderer; 16 | $this->rendererData = $data; 17 | $this->rendererContext = $context; 18 | } 19 | 20 | protected function getDokuWikiVersion() { 21 | return $rendererContext['dokuwiki_version']; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/DokuWiki/Plugin/Mdpage/Markdown/Traditional.php: -------------------------------------------------------------------------------- 1 | renderer = $renderer; 16 | $this->rendererData = $data; 17 | $this->rendererContext = $context; 18 | } 19 | 20 | protected function getDokuWikiVersion() { 21 | return $rendererContext['dokuwiki_version']; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/DokuWiki/Plugin/Mdpage/MarkdownRendererTrait.php: -------------------------------------------------------------------------------- 1 | isParsed) { 18 | return false; 19 | } 20 | 21 | $this->isParsed = true; 22 | $this->renderPos = strlen($this->renderer->doc); 23 | 24 | return $this->parse($content); 25 | } 26 | 27 | private function getRenderResult($escapedPos = null) { 28 | if ($escapedPos === null) { 29 | $renderPos = $this->renderPos; 30 | } else { 31 | $renderPos = $escapedPos; 32 | } 33 | 34 | $result = substr($this->renderer->doc, $renderPos); 35 | $this->renderPos = strlen($this->renderer->doc); 36 | 37 | return $result; 38 | } 39 | 40 | protected function collectText($blocks) { 41 | $result = ''; 42 | 43 | foreach ($blocks as $block) { 44 | if ($block[0] == 'text') { 45 | $result .= $block[1]; 46 | } 47 | } 48 | 49 | return $result; 50 | } 51 | 52 | // Parser 53 | 54 | protected function renderParagraph($block) { 55 | $escapedPos = $this->renderPos; 56 | 57 | $this->renderer->p_open(); 58 | $this->renderAbsy($block['content']); 59 | $this->renderer->p_close(); 60 | 61 | return $this->getRenderResult($escapedPos); 62 | } 63 | 64 | // Markdown 65 | 66 | protected function renderText($block) { 67 | $contentLines = preg_split('/ +\n/', $block[1]); 68 | 69 | $first = true; 70 | foreach ($contentLines as $contentLine) { 71 | if ($first) { 72 | $first = false; 73 | } else { 74 | $this->renderer->linebreak(); 75 | } 76 | $this->renderer->cdata(html_entity_decode($contentLine)); 77 | } 78 | 79 | return $this->getRenderResult(); 80 | } 81 | 82 | // block\CodeTrait 83 | 84 | protected function renderCode($block) { 85 | $lang = null; 86 | if (array_key_exists('language', $block)) { 87 | $lang = $block['language']; 88 | } 89 | 90 | $this->renderer->code($block['content'], $lang); 91 | 92 | return $this->getRenderResult(); 93 | } 94 | 95 | // block\HeadlineTrait 96 | 97 | protected function renderHeadline($block) { 98 | $content = $this->collectText($block['content']); 99 | 100 | $this->renderer->header(html_entity_decode($content), $block['level'], $this->rendererContext['pos']); 101 | 102 | return $this->getRenderResult(); 103 | } 104 | 105 | // block\HtmlTrait 106 | 107 | private function isCommentOnlyXMLString($content) { 108 | if (preg_match('/^\s*\s*$/', $content)) { 109 | return true; 110 | } 111 | 112 | return false; 113 | } 114 | 115 | // Note: Fallback html rendering for DokuWiki 2018-04-22a 116 | // 117 | // See https://github.com/splitbrain/dokuwiki/issues/2563 118 | // We should fallback for DokuWiki 2018-04-22a to avoid `Function create_function() is deprecated` 119 | private function isGeshiFallbackVersion() { 120 | return phpversion() >= '7.2' 121 | && substr($this->getDokuWikiVersion(), 0, 10) == '2018-04-22'; 122 | } 123 | 124 | protected function renderHtml($block) { 125 | $content = $block['content']."\n"; 126 | 127 | if ($this->isCommentOnlyXMLString($content)) { 128 | return ''; 129 | } 130 | 131 | global $conf; 132 | if ($this->isGeshiFallbackVersion() && !$conf['htmlok']) { 133 | $this->renderer->monospace_open(); 134 | $this->renderer->cdata($content); 135 | $this->renderer->monospace_close(); 136 | } else { 137 | $this->renderer->htmlblock($content); 138 | } 139 | 140 | return $this->getRenderResult(); 141 | } 142 | 143 | protected function renderInlineHtml($block) { 144 | $content = $block[1]; 145 | 146 | if ($this->isCommentOnlyXMLString($content)) { 147 | return ''; 148 | } 149 | 150 | global $conf; 151 | if ($this->isGeshiFallbackVersion() && !$conf['htmlok']) { 152 | $this->renderer->monospace_open(); 153 | $this->renderer->cdata($content); 154 | $this->renderer->monospace_close(); 155 | } else { 156 | $this->renderer->html($content); 157 | } 158 | 159 | return $this->getRenderResult(); 160 | } 161 | 162 | // block\ListTrait 163 | 164 | protected function renderList($block) { 165 | $escapedPos = $this->renderPos; 166 | 167 | if ($block['list'] == 'ol') { 168 | $this->renderer->listo_open(); 169 | } else { 170 | $this->renderer->listu_open(); 171 | } 172 | 173 | foreach ($block['items'] as $item => $itemLines) { 174 | $this->renderer->listitem_open($this->listLevel); 175 | $this->listLevel = $this->listLevel + 1; 176 | 177 | $this->renderer->listcontent_open(); 178 | $this->renderAbsy($itemLines); 179 | $this->renderer->listcontent_close(); 180 | 181 | $this->listLevel = $this->listLevel - 1; 182 | $this->renderer->listitem_close(); 183 | } 184 | 185 | if ($block['list'] == 'ol') { 186 | $this->renderer->listo_close(); 187 | } else { 188 | $this->renderer->listu_close(); 189 | } 190 | 191 | return $this->getRenderResult($escapedPos); 192 | } 193 | 194 | // block\QuoteTrait 195 | 196 | protected function renderQuote($block) { 197 | $escapedPos = $this->renderPos; 198 | 199 | $this->renderer->quote_open(); 200 | $this->renderAbsy($block['content']); 201 | $this->renderer->quote_close(); 202 | 203 | return $this->getRenderResult($escapedPos); 204 | } 205 | 206 | // block\RuleTrait 207 | 208 | protected function renderHr($block) { 209 | $this->renderer->hr(); 210 | 211 | return $this->getRenderResult(); 212 | } 213 | 214 | // block\TableTrait 215 | 216 | protected function renderTable($block) { 217 | $escapedPos = $this->renderPos; 218 | 219 | $this->renderer->table_open(); 220 | 221 | $cols = $block['cols']; 222 | $first = true; 223 | foreach ($block['rows'] as $row) { 224 | if ($first) { 225 | $first = false; 226 | 227 | $this->renderer->tablethead_open(); 228 | foreach ($row as $c => $cell) { 229 | $align = empty($cols[$c]) ? null : $cols[$c]; 230 | $this->renderer->tableheader_open(1, $align); 231 | $this->renderAbsy($cell); 232 | $this->renderer->tableheader_close(); 233 | } 234 | $this->renderer->tablethead_close(); 235 | 236 | continue; 237 | } 238 | 239 | $this->renderer->tablerow_open(); 240 | foreach ($row as $c => $cell) { 241 | $align = empty($cols[$c]) ? null : $cols[$c]; 242 | $this->renderer->tablecell_open(1, $align); 243 | $this->renderAbsy($cell); 244 | $this->renderer->tablecell_close(); 245 | } 246 | $this->renderer->tablerow_close(); 247 | } 248 | 249 | $this->renderer->table_close(); 250 | 251 | return $this->getRenderResult($escapedPos); 252 | } 253 | 254 | // inline\CodeTrait 255 | 256 | protected function renderInlineCode($block) { 257 | $this->renderer->monospace_open(); 258 | $this->renderer->cdata($block[1]); 259 | $this->renderer->monospace_close(); 260 | 261 | return $this->getRenderResult(); 262 | } 263 | 264 | // inline\EmphStrongTrait 265 | 266 | protected function renderStrong($block) { 267 | $escapedPos = $this->renderPos; 268 | 269 | $this->renderer->strong_open(); 270 | $this->renderAbsy($block[1]); 271 | $this->renderer->strong_close(); 272 | 273 | return $this->getRenderResult($escapedPos); 274 | } 275 | 276 | protected function renderEmph($block) { 277 | $escapedPos = $this->renderPos; 278 | 279 | $this->renderer->emphasis_open(); 280 | $this->renderAbsy($block[1]); 281 | $this->renderer->emphasis_close(); 282 | 283 | return $this->getRenderResult($escapedPos); 284 | } 285 | 286 | // inline\LinkTrait 287 | 288 | protected function renderEmail($block) { 289 | $this->renderer->emaillink($block[1]); 290 | 291 | return $this->getRenderResult(); 292 | } 293 | 294 | protected function renderUrl($block) { 295 | $this->renderer->externallink($block[1]); 296 | 297 | return $this->getRenderResult(); 298 | } 299 | 300 | abstract protected function lookupReference($key); 301 | 302 | abstract protected function parseInline($line); 303 | 304 | private function lookupRefKeyWithFallback($prefix, $block) { 305 | if (!isset($block['refkey'])) { 306 | return $block; 307 | } 308 | 309 | if (($ref = $this->lookupReference($block['refkey'])) !== false) { 310 | return array_merge($block, $ref); 311 | } 312 | 313 | $prefix_len = strlen($prefix); 314 | if (strncmp($block['orig'], $prefix, $prefix_len) === 0) { 315 | $this->renderer->cdata($prefix); 316 | $this->renderAbsy($this->parseInline(substr($block['orig'], $prefix_len))); 317 | } else { 318 | $this->renderer->cdata($block['orig']); 319 | } 320 | 321 | return false; 322 | } 323 | 324 | /** 325 | * Note: Avoid License Conflicting for Links with Titles 326 | * 327 | * DokuWiki is not supported links with titles, but Markdown is supported it. 328 | * We decided not to support links with titles before 2.1.0. However, since 329 | * many users voting the feature, we support it from 2.2.0. 330 | * 331 | * The simple way to support links with titles is copying methods from DokuWiki 332 | * and modifying. However, DokuWiki is licensed under the GPL-2.0-or-later and 333 | * this plugin is licensed under the Apache-2.0 OR GPL-2.0-or-later. So, we cannot 334 | * use parts of DokuWiki's source codes. Therefore, we use dangerous operations to 335 | * support links with titles for user needs. Be careful for this feature. 336 | * 337 | * Ref: https://github.com/mizunashi-mana/dokuwiki-plugin-mdpage/issues/35 338 | */ 339 | protected function renderLink($block) { 340 | $escapedPos = $this->renderPos; 341 | 342 | if (($block = $this->lookupRefKeyWithFallback('[', $block)) === false) { 343 | return $this->getRenderResult($escapedPos); 344 | } 345 | 346 | // See https://github.com/splitbrain/dokuwiki/blob/cbaf278c50e5baf946b3bd606c369735fe0953be/inc/parser/handler.php#L527 347 | $url = $block['url']; 348 | $text = $this->collectText($block['text']); 349 | $title = $block['title']; 350 | 351 | if (link_isinterwiki($url)) { 352 | // Interwiki 353 | $interwiki = explode('>', $url, 2); 354 | $this->renderDokuWikiInterwikiLink($url, $text, strtolower($interwiki[0]), $interwiki[1], $title); 355 | } elseif (preg_match('#^([a-z0-9\-\.+]+?)://#i', $url)) { 356 | // external link (accepts all protocols) 357 | $this->renderDokuWikiExternalLink($url, $text, $title); 358 | } elseif (preg_match('!^#.+!', $url)) { 359 | // local link 360 | $this->renderDokuWikiLocalLink(substr($url, 1), $text, $title); 361 | } else { 362 | // internal link 363 | $this->renderDokuWikiInternalLink($url, $text, $title); 364 | } 365 | 366 | return $this->getRenderResult($escapedPos); 367 | } 368 | 369 | private function renderDokuWikiInterwikiLink($match, $name, $wikiName, $wikiUri, $title = null) { 370 | $escapedPos = $this->renderPos; 371 | 372 | $this->renderer->interwikilink($match, $name, $wikiName, $wikiUri); 373 | 374 | if ($title === null) { 375 | return; 376 | } 377 | 378 | // See the note "Avoid License Conflicting for Links with Titles" 379 | $renderedContent = substr($this->renderer->doc, $escapedPos); 380 | $replacedContent = $this->replaceDokuWikiLinkTitle($renderedContent, $title); 381 | $this->renderer->doc = substr_replace($this->renderer->doc, $replacedContent, $escapedPos); 382 | } 383 | 384 | private function renderDokuWikiExternalLink($url, $name, $title = null) { 385 | $escapedPos = $this->renderPos; 386 | 387 | $this->renderer->externallink($url, $name); 388 | 389 | if ($title === null) { 390 | return; 391 | } 392 | 393 | // See the note "Avoid License Conflicting for Links with Titles" 394 | $renderedContent = substr($this->renderer->doc, $escapedPos); 395 | $replacedContent = $this->replaceDokuWikiLinkTitle($renderedContent, $title); 396 | $this->renderer->doc = substr_replace($this->renderer->doc, $replacedContent, $escapedPos); 397 | } 398 | 399 | private function renderDokuWikiLocalLink($hash, $name, $title = null) { 400 | $escapedPos = $this->renderPos; 401 | 402 | $this->renderer->locallink($hash, $name); 403 | 404 | if ($title === null) { 405 | return; 406 | } 407 | 408 | // See the note "Avoid License Conflicting for Links with Titles" 409 | $renderedContent = substr($this->renderer->doc, $escapedPos); 410 | $replacedContent = $this->replaceDokuWikiLinkTitle($renderedContent, $title); 411 | $this->renderer->doc = substr_replace($this->renderer->doc, $replacedContent, $escapedPos); 412 | } 413 | 414 | private function renderDokuWikiInternalLink($id, $name, $title = null) { 415 | $escapedPos = $this->renderPos; 416 | 417 | $this->renderer->internallink($id, $name); 418 | 419 | if ($title === null) { 420 | return; 421 | } 422 | 423 | // See the note "Avoid License Conflicting for Links with Titles" 424 | $renderedContent = substr($this->renderer->doc, $escapedPos); 425 | $replacedContent = $this->replaceDokuWikiLinkTitle($renderedContent, $title); 426 | $this->renderer->doc = substr_replace($this->renderer->doc, $replacedContent, $escapedPos); 427 | } 428 | 429 | /** 430 | * Ref: https://github.com/splitbrain/dokuwiki/blob/release_stable_2020-07-29/inc/parser/xhtml.php#L1601. 431 | */ 432 | private function replaceDokuWikiLinkTitle($linkContent, $title) { 433 | $replacedTitle = strtr( 434 | htmlspecialchars($title), 435 | [ 436 | '>' => '%3E', 437 | '<' => '%3C', 438 | '"' => '%22', 439 | ] 440 | ); 441 | 442 | return preg_replace( 443 | '/]*) title="([^"]*)"([^>]*)>/', 444 | '', 445 | $linkContent 446 | ); 447 | } 448 | 449 | protected function renderImage($block) { 450 | $escapedPos = $this->renderPos; 451 | 452 | if (($block = $this->lookupRefKeyWithFallback('![', $block)) === false) { 453 | return $this->getRenderResult($escapedPos); 454 | } 455 | 456 | // See https://github.com/splitbrain/dokuwiki/blob/cbaf278c50e5baf946b3bd606c369735fe0953be/inc/parser/handler.php#L722 457 | $url = $block['url']; 458 | $text = $block['text']; 459 | 460 | if (media_isexternal($url) || link_isinterwiki($url)) { 461 | $this->renderer->externalmedia($url, $text); 462 | } else { 463 | $this->renderer->internalmedia($url, $text); 464 | } 465 | 466 | return $this->getRenderResult($escapedPos); 467 | } 468 | 469 | // inline\StrikeoutTrait 470 | 471 | protected function renderStrike($block) { 472 | $escapedPos = $this->renderPos; 473 | 474 | $this->renderer->deleted_open(); 475 | $this->renderAbsy($block[1]); 476 | $this->renderer->deleted_close(); 477 | 478 | return $this->getRenderResult($escapedPos); 479 | } 480 | 481 | // inline\UrlLinkTrait 482 | 483 | protected function renderAutoUrl($block) { 484 | $this->renderer->externallink($block[1]); 485 | 486 | return $this->getRenderResult(); 487 | } 488 | } 489 | -------------------------------------------------------------------------------- /src/bootstrap.php: -------------------------------------------------------------------------------- 1 | dokuwikiVersion == null) { 14 | $this->dokuwikiVersion = getVersionData()['date']; 15 | } 16 | 17 | return $this->dokuwikiVersion; 18 | } 19 | 20 | public function getType() { 21 | return 'protected'; 22 | } 23 | 24 | public function getPType() { 25 | return 'block'; 26 | } 27 | 28 | public function getSort() { 29 | return 69; 30 | } 31 | 32 | public function getPluginName() { 33 | return $this->getInfo()['base']; 34 | } 35 | 36 | public function getPluginMode() { 37 | return 'plugin_' . $this->getPluginName(); 38 | } 39 | 40 | public function connectTo($mode) { 41 | if ($this->getConf('markdown_default')) { 42 | $this->Lexer->addEntryPattern('\\A(?!.*).', $mode, $this->getPluginMode()); 43 | $this->Lexer->addEntryPattern('', $mode, $this->getPluginMode()); 44 | $this->Lexer->addEntryPattern('', $mode, $this->getPluginMode()); 45 | } else { 46 | $this->Lexer->addEntryPattern('(?=.*)', $mode, $this->getPluginMode()); 47 | } 48 | } 49 | 50 | public function postConnect() { 51 | $pluginBaseMode = 'plugin_' . $this->getPluginName(); 52 | 53 | if ($this->getConf('markdown_default')) { 54 | $this->Lexer->addExitPattern('\\z', $this->getPluginMode()); 55 | $this->Lexer->addExitPattern('|', $match)) { 67 | $new_pos = $new_pos - strlen(''); 68 | } else if (preg_match('|^|', $match)) { 69 | $new_pos = $new_pos - strlen(''); 70 | } 71 | } else { 72 | $new_pos = $new_pos - strlen(''); 73 | } 74 | 75 | return [ 76 | 'render' => true, 77 | 'match' => $match, 78 | 'pos' => $new_pos, 79 | ]; 80 | default: 81 | return [ 82 | 'render' => false, 83 | ]; 84 | } 85 | } 86 | 87 | public function render($format, Doku_Renderer $renderer, $data) { 88 | if (!$data['render']) { 89 | return true; 90 | } 91 | 92 | $match = $data['match']; 93 | return $this->renderWithRenderer($renderer, $match, $data); 94 | } 95 | 96 | protected function renderWithRenderer(Doku_Renderer $renderer, $match, $data) { 97 | switch ($this->getConf('flavor')) { 98 | case 'github-flavored': 99 | $flavor = Markdown::GITHUB_FLAVORED; 100 | break; 101 | case 'markdown-extra': 102 | $flavor = Markdown::MARKDOWN_EXTRA; 103 | break; 104 | case 'traditional': 105 | $flavor = Markdown::TRADITIONAL; 106 | break; 107 | default: 108 | $flavor = Markdown::GITHUB_FLAVORED; 109 | break; 110 | } 111 | 112 | $context = [ 113 | 'dokuwiki_version' => $this->dokuwikiVersion, 114 | 'flavor' => $flavor, 115 | ]; 116 | 117 | $result = Markdown::parseWithRenderer($renderer, $match, $data, $context); 118 | /* 119 | echo '
';
120 |         var_dump(htmlspecialchars($match));
121 |         var_dump(htmlspecialchars($result));
122 |         echo '
'; 123 | */ 124 | 125 | return true; 126 | } 127 | 128 | protected function _debug($message, $err, $line, $file = __FILE__) { 129 | if ($this->getConf('debug')) { 130 | msg($message, $err, $line, $file); 131 | } 132 | } 133 | 134 | } 135 | -------------------------------------------------------------------------------- /tests/DokuWiki/Test/Plugin/Mdpage/MarkdownSpecTest.php: -------------------------------------------------------------------------------- 1 | specsDirPath = PROJECT_ROOT_DIR_PATH.'/tests/specs'; 19 | $this->defaultFlavors = [ 20 | Markdown::GITHUB_FLAVORED, 21 | Markdown::MARKDOWN_EXTRA, 22 | Markdown::TRADITIONAL, 23 | ]; 24 | } 25 | 26 | public function testFeatures() { 27 | $this->assertSpec( 28 | 'features/Content', 29 | $this->defaultFlavors 30 | ); 31 | } 32 | 33 | public function testHtmlok() { 34 | global $conf; 35 | $conf['htmlok'] = 1; 36 | 37 | $this->assertSpec( 38 | 'htmlok/Content', 39 | $this->defaultFlavors 40 | ); 41 | } 42 | 43 | public function testWithoutHtmlok() { 44 | $this->assertSpec( 45 | 'without-htmlok/Content', 46 | $this->defaultFlavors 47 | ); 48 | } 49 | 50 | public function testDokuwikiInternal() { 51 | $this->assertSpec( 52 | 'dokuwiki-internal/Content', 53 | $this->defaultFlavors 54 | ); 55 | } 56 | 57 | public function testCannotLookupRef() { 58 | $this->assertSpec( 59 | 'cannot-lookup-ref/Content', 60 | $this->defaultFlavors 61 | ); 62 | } 63 | 64 | public function testIssue24() { 65 | $this->assertSpec( 66 | 'issue-24/Content', 67 | $this->defaultFlavors 68 | ); 69 | } 70 | 71 | public function testIssue35() { 72 | $this->assertSpec( 73 | 'issue-35/Content', 74 | $this->defaultFlavors 75 | ); 76 | } 77 | 78 | public function testIssue40() { 79 | $this->assertSpec( 80 | 'issue-40/Content', 81 | $this->defaultFlavors 82 | ); 83 | } 84 | 85 | public function testIssue50() { 86 | $this->assertSpec( 87 | 'issue-50/Content', 88 | $this->defaultFlavors 89 | ); 90 | } 91 | 92 | public function testMetadata() { 93 | $this->assertMetaSpec( 94 | 'metadata/Content', 95 | [ 96 | Markdown::GITHUB_FLAVORED, 97 | ] 98 | ); 99 | } 100 | 101 | private function getDokuWikiVersion() { 102 | return getVersionData()['date']; 103 | } 104 | 105 | private function renderMarkdownToXHTML($text, $flavor) { 106 | $renderer = new Doku_Renderer_xhtml(); 107 | $data = [ 108 | 'pos' => 0, 109 | ]; 110 | $context = [ 111 | 'dokuwiki_version' => $this->getDokuWikiVersion(), 112 | 'flavor' => $flavor, 113 | ]; 114 | 115 | $result = Markdown::parseWithRenderer($renderer, $text, $data, $context); 116 | $this->assertEquals($renderer->doc, $result); 117 | 118 | return $result; 119 | } 120 | 121 | private function renderMarkdownToMetadata($text, $flavor) { 122 | $renderer = new Doku_Renderer_metadata(); 123 | $data = [ 124 | 'pos' => 0, 125 | ]; 126 | $context = [ 127 | 'dokuwiki_version' => $this->getDokuWikiVersion(), 128 | 'flavor' => $flavor, 129 | ]; 130 | 131 | $result = Markdown::parseWithRenderer($renderer, $text, $data, $context); 132 | $this->assertEquals($renderer->doc, $result); 133 | 134 | return $result; 135 | } 136 | 137 | private function assertXHTML($target_md, $expected_xhtml, $flavor) { 138 | $expected = new DOMDocument(); 139 | $expected->loadHTML($expected_xhtml); 140 | 141 | $actual = new DOMDocument(); 142 | $actual->loadHTML($this->renderMarkdownToXHTML($target_md, $flavor)); 143 | 144 | $this->assertEquals( 145 | $expected, 146 | $actual, 147 | 'Failed asserting markdown and XHTML for '.$flavor 148 | ); 149 | } 150 | 151 | private function assertMetadata($target_md, $expected_metadata, $flavor) { 152 | $expected = $expected_metadata; 153 | 154 | $actual = $this->renderMarkdownToMetadata($target_md, $flavor); 155 | 156 | $this->assertEquals( 157 | $expected, 158 | $actual, 159 | 'Failed asserting markdown and Metadata for '.$flavor 160 | ); 161 | } 162 | 163 | private function assertSpec($basename, $flavors) { 164 | $basepath = $this->specsDirPath.'/'.$basename; 165 | 166 | $content_md = file_get_contents($basepath.'.md'); 167 | foreach ($flavors as $flavor) { 168 | $content_xhtml = file_get_contents($basepath.'_'.$flavor.'.html'); 169 | $this->assertXHTML($content_md, $content_xhtml, $flavor); 170 | } 171 | } 172 | 173 | private function assertMetaSpec($basename, $flavors) { 174 | $basepath = $this->specsDirPath.'/'.$basename; 175 | 176 | $content_md = file_get_contents($basepath.'.md'); 177 | foreach ($flavors as $flavor) { 178 | $content_xhtml = file_get_contents($basepath.'_'.$flavor.'.meta.txt'); 179 | $this->assertMetadata($content_md, $content_xhtml, $flavor); 180 | } 181 | } 182 | } 183 | -------------------------------------------------------------------------------- /tests/bootstrap.php: -------------------------------------------------------------------------------- 1 | 2 | [link-ref][link-ref] 3 |

4 | 5 |

6 | ![image-ref][image-ref] 7 |

8 | -------------------------------------------------------------------------------- /tests/specs/cannot-lookup-ref/Content_MarkdownExtra.html: -------------------------------------------------------------------------------- 1 |

2 | [link-ref][link-ref] 3 |

4 | 5 |

6 | ![image-ref][image-ref] 7 |

8 | -------------------------------------------------------------------------------- /tests/specs/cannot-lookup-ref/Content_Traditional.html: -------------------------------------------------------------------------------- 1 |

2 | [link-ref][link-ref] 3 |

4 | 5 |

6 | ![image-ref][image-ref] 7 |

8 | -------------------------------------------------------------------------------- /tests/specs/dokuwiki-internal/Content.md: -------------------------------------------------------------------------------- 1 | ![internal-logo](wiki:dokuwiki-128.png) 2 | 3 | [internal-link](:wiki:syntax) 4 | -------------------------------------------------------------------------------- /tests/specs/dokuwiki-internal/Content_GFM.html: -------------------------------------------------------------------------------- 1 |

2 | internal-logo 3 |

4 | 5 |

6 | internal-link 7 |

8 | -------------------------------------------------------------------------------- /tests/specs/dokuwiki-internal/Content_MarkdownExtra.html: -------------------------------------------------------------------------------- 1 |

2 | internal-logo 3 |

4 | 5 |

6 | internal-link 7 |

8 | -------------------------------------------------------------------------------- /tests/specs/dokuwiki-internal/Content_Traditional.html: -------------------------------------------------------------------------------- 1 |

2 | internal-logo 3 |

4 | 5 |

6 | internal-link 7 |

8 | -------------------------------------------------------------------------------- /tests/specs/features/Content.md: -------------------------------------------------------------------------------- 1 | # Header 2 | 3 | 4 | 5 | simple paragraph: *emph*, **strong**, ~~strike~~ and `mono`. 6 | 7 | inline html 8 |
You need to enable htmlok on DokuWiki configuration.
9 |
10 | 11 | > quote 12 | 13 | ```plain 14 | code block 15 | ``` 16 | 17 | https://www.dokuwiki.org/ 18 | 19 | 20 | 21 | 22 | 23 | [link](https://www.dokuwiki.org) 24 | 25 | ![image](https://secure.php.net/images/php.gif) 26 | 27 | [link-ref][link-ref] 28 | 29 | [link-ref]: https://www.dokuwiki.org 30 | 31 | ![image-ref][image-ref] 32 | 33 | [image-ref]: https://secure.php.net/images/php.gif 34 | 35 | ---- 36 | 37 | * List 38 | - Sub item 1 39 | - Sub item 2 40 | * Item 2 41 | - Sub item 1 42 | 43 | 1. Ordered List 44 | - Sub item 1 45 | 2. Item 2 46 | - Sub item 1 47 | 48 | | head 1 | head 2 | head 3 | head 4 | 49 | |:---: | :---| ---: | --- | 50 | | col 1x1 | col 1x2 | col 1x3 | col 1x4 | 51 | | col 2x1 | col 2x2 | col 2x3 | col 2x4 | 52 | -------------------------------------------------------------------------------- /tests/specs/features/Content_GFM.html: -------------------------------------------------------------------------------- 1 |

Header

2 | 3 |

4 | simple paragraph: emph, strong, strike and mono. 5 |

6 |
<summary>inline html
 7 | <details>You need to enable <code>htmlok</code> on DokuWiki configuration.</details>
 8 | </summary>
9 | 10 |

11 | quote 12 |

13 |
14 |
code block
15 | 16 |

17 | https://www.dokuwiki.org/ 18 |

19 | 20 |

21 | https://www.dokuwiki.org/ 22 |

23 | 24 |

25 | noreply@noreply.com 26 |

27 | 28 |

29 | link 30 |

31 | 32 |

33 | image 34 |

35 | 36 |

37 | link-ref 38 |

39 | 40 |

41 | image-ref 42 |

43 |
44 |
    45 |
  • List
      46 |
    • Sub item 1
      47 |
    • 48 |
    • Sub item 2
      49 |
    • 50 |
    51 |
    52 |
  • 53 |
  • Item 2
      54 |
    • Sub item 1
      55 |
    • 56 |
    57 |
    58 |
  • 59 |
60 |
    61 |
  1. Ordered List
      62 |
    • Sub item 1
      63 |
    • 64 |
    65 |
    66 |
  2. 67 |
  3. Item 2
      68 |
    • Sub item 1
      69 |
    • 70 |
    71 |
    72 |
  4. 73 |
74 |
75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 |
head 1 head 2 head 3 head 4
col 1x1 col 1x2 col 1x3 col 1x4
col 2x1 col 2x2 col 2x3 col 2x4
84 | -------------------------------------------------------------------------------- /tests/specs/features/Content_MarkdownExtra.html: -------------------------------------------------------------------------------- 1 |

Header

2 | 3 |

4 | simple paragraph: emph, strong, ~~strike~~ and mono. 5 |

6 |
<summary>inline html
 7 | <details>You need to enable <code>htmlok</code> on DokuWiki configuration.</details>
 8 | </summary>
9 | 10 |

11 | quote 12 |

13 |
14 |
code block
15 | 16 |

17 | https://www.dokuwiki.org/ 18 |

19 | 20 |

21 | https://www.dokuwiki.org/ 22 |

23 | 24 |

25 | noreply@noreply.com 26 |

27 | 28 |

29 | link 30 |

31 | 32 |

33 | image 34 |

35 | 36 |

37 | link-ref 38 |

39 | 40 |

41 | image-ref 42 |

43 |
44 |
    45 |
  • List
      46 |
    • Sub item 1
      47 |
    • 48 |
    • Sub item 2
      49 |
    • 50 |
    51 |
    52 |
  • 53 |
  • Item 2
      54 |
    • Sub item 1
      55 |
    • 56 |
    57 |
    58 |
  • 59 |
60 |
    61 |
  1. Ordered List
      62 |
    • Sub item 1
      63 |
    • 64 |
    65 |
    66 |
  2. 67 |
  3. Item 2
      68 |
    • Sub item 1
      69 |
    • 70 |
    71 |
    72 |
  4. 73 |
74 |
75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 |
head 1 head 2 head 3 head 4
col 1x1 col 1x2 col 1x3 col 1x4
col 2x1 col 2x2 col 2x3 col 2x4
84 | -------------------------------------------------------------------------------- /tests/specs/features/Content_Traditional.html: -------------------------------------------------------------------------------- 1 |

Header

2 | 3 |

4 | simple paragraph: emph, strong, ~~strike~~ and mono. 5 |

6 |
<summary>inline html
 7 | <details>You need to enable <code>htmlok</code> on DokuWiki configuration.</details>
 8 | </summary>
9 | 10 |

11 | quote 12 |

13 |
14 | 15 |

16 | `plain 17 | code block 18 | ` 19 |

20 | 21 |

22 | https://www.dokuwiki.org/ 23 |

24 | 25 |

26 | https://www.dokuwiki.org/ 27 |

28 | 29 |

30 | noreply@noreply.com 31 |

32 | 33 |

34 | link 35 |

36 | 37 |

38 | image 39 |

40 | 41 |

42 | link-ref 43 |

44 | 45 |

46 | image-ref 47 |

48 |
49 |
    50 |
  • List
      51 |
    • Sub item 1
      52 |
    • 53 |
    • Sub item 2
      54 |
    • 55 |
    56 |
    57 |
  • 58 |
  • Item 2
      59 |
    • Sub item 1
      60 |
    • 61 |
    62 |
    63 |
  • 64 |
65 |
    66 |
  1. Ordered List
      67 |
    • Sub item 1
      68 |
    • 69 |
    70 |
    71 |
  2. 72 |
  3. Item 2
      73 |
    • Sub item 1
      74 |
    • 75 |
    76 |
    77 |
  4. 78 |
79 | 80 |

81 | | head 1 | head 2 | head 3 | head 4 | 82 | |:---: | :---| ---: | --- | 83 | | col 1x1 | col 1x2 | col 1x3 | col 1x4 | 84 | | col 2x1 | col 2x2 | col 2x3 | col 2x4 | 85 |

86 | -------------------------------------------------------------------------------- /tests/specs/htmlok/Content.md: -------------------------------------------------------------------------------- 1 | # Header 2 | 3 | Inline HTML: 4 | 5 | deleted 6 | 7 | 8 | -------------------------------------------------------------------------------- /tests/specs/htmlok/Content_GFM.html: -------------------------------------------------------------------------------- 1 |

Header

2 | 3 |

4 | Inline HTML: 5 |

6 | 7 |

8 | deleted 9 |

10 | -------------------------------------------------------------------------------- /tests/specs/htmlok/Content_MarkdownExtra.html: -------------------------------------------------------------------------------- 1 |

Header

2 | 3 |

4 | Inline HTML: 5 |

6 | 7 |

8 | deleted 9 |

10 | -------------------------------------------------------------------------------- /tests/specs/htmlok/Content_Traditional.html: -------------------------------------------------------------------------------- 1 |

Header

2 | 3 |

4 | Inline HTML: 5 |

6 | 7 |

8 | deleted 9 |

10 | -------------------------------------------------------------------------------- /tests/specs/issue-24/Content.md: -------------------------------------------------------------------------------- 1 | This is includes HTML special characters: < > & " ' 2 | -------------------------------------------------------------------------------- /tests/specs/issue-24/Content_GFM.html: -------------------------------------------------------------------------------- 1 |

2 | This is includes HTML special characters: < > & " ' 3 |

4 | -------------------------------------------------------------------------------- /tests/specs/issue-24/Content_MarkdownExtra.html: -------------------------------------------------------------------------------- 1 |

2 | This is includes HTML special characters: < > & " ' 3 |

4 | -------------------------------------------------------------------------------- /tests/specs/issue-24/Content_Traditional.html: -------------------------------------------------------------------------------- 1 |

2 | This is includes HTML special characters: < > & " ' 3 |

4 | -------------------------------------------------------------------------------- /tests/specs/issue-35/Content.md: -------------------------------------------------------------------------------- 1 | [external link](https://example.com "title") 2 | [internal link](wiki:syntax "title") 3 | [external link without title](https://example.com) 4 | [internal link without title](wiki:syntax) 5 | -------------------------------------------------------------------------------- /tests/specs/issue-35/Content_GFM.html: -------------------------------------------------------------------------------- 1 |

2 | external link 3 | internal link 4 | external link without title 5 | internal link without title 6 |

7 | -------------------------------------------------------------------------------- /tests/specs/issue-35/Content_MarkdownExtra.html: -------------------------------------------------------------------------------- 1 |

2 | external link 3 | internal link 4 | external link without title 5 | internal link without title 6 |

7 | -------------------------------------------------------------------------------- /tests/specs/issue-35/Content_Traditional.html: -------------------------------------------------------------------------------- 1 |

2 | external link 3 | internal link 4 | external link without title 5 | internal link without title 6 |

7 | -------------------------------------------------------------------------------- /tests/specs/issue-40/Content.md: -------------------------------------------------------------------------------- 1 | aaa 2 | bbb 3 | ccc 4 | 5 | aaa 6 | bbb 7 | -------------------------------------------------------------------------------- /tests/specs/issue-40/Content_GFM.html: -------------------------------------------------------------------------------- 1 |

2 | aaa
3 | bbb
4 | ccc 5 |

6 | 7 |

8 | aaa 9 | bbb 10 |

11 | -------------------------------------------------------------------------------- /tests/specs/issue-40/Content_MarkdownExtra.html: -------------------------------------------------------------------------------- 1 |

2 | aaa
3 | bbb
4 | ccc 5 |

6 | 7 |

8 | aaa 9 | bbb 10 |

11 | -------------------------------------------------------------------------------- /tests/specs/issue-40/Content_Traditional.html: -------------------------------------------------------------------------------- 1 |

2 | aaa
3 | bbb
4 | ccc 5 |

6 | 7 |

8 | aaa 9 | bbb 10 |

11 | -------------------------------------------------------------------------------- /tests/specs/issue-50/Content.md: -------------------------------------------------------------------------------- 1 | # Test 1, Test 2 & More tests 2 | 3 | This is text 4 | -------------------------------------------------------------------------------- /tests/specs/issue-50/Content_GFM.html: -------------------------------------------------------------------------------- 1 |

Test 1, Test 2 & More tests

2 | 3 |

4 | This is text 5 |

6 | -------------------------------------------------------------------------------- /tests/specs/issue-50/Content_MarkdownExtra.html: -------------------------------------------------------------------------------- 1 |

Test 1, Test 2 & More tests

2 | 3 |

4 | This is text 5 |

6 | -------------------------------------------------------------------------------- /tests/specs/issue-50/Content_Traditional.html: -------------------------------------------------------------------------------- 1 |

Test 1, Test 2 & More tests

2 | 3 |

4 | This is text 5 |

6 | -------------------------------------------------------------------------------- /tests/specs/metadata/Content.md: -------------------------------------------------------------------------------- 1 | # Header 2 | 3 | 4 | 5 | simple paragraph: *emph*, **strong**, ~~strike~~ and `mono`. 6 | 7 | inline html 8 |
You need to enable htmlok on DokuWiki configuration.
9 |
10 | 11 | > quote 12 | 13 | ```plain 14 | code block 15 | ``` 16 | 17 | https://www.dokuwiki.org/ 18 | 19 | 20 | 21 | 22 | 23 | [link](https://www.dokuwiki.org) 24 | 25 | ![image](https://secure.php.net/images/php.gif) 26 | 27 | [link-ref][link-ref] 28 | 29 | [link-ref]: https://www.dokuwiki.org 30 | 31 | ![image-ref][image-ref] 32 | 33 | [image-ref]: https://secure.php.net/images/php.gif 34 | 35 | ---- 36 | 37 | * List 38 | - Sub item 1 39 | - Sub item 2 40 | * Item 2 41 | - Sub item 1 42 | 43 | 1. Ordered List 44 | - Sub item 1 45 | 2. Item 2 46 | - Sub item 1 47 | 48 | | head 1 | head 2 | head 3 | head 4 | 49 | |:---: | :---| ---: | --- | 50 | | col 1x1 | col 1x2 | col 1x3 | col 1x4 | 51 | | col 2x1 | col 2x2 | col 2x3 | col 2x4 | 52 | -------------------------------------------------------------------------------- /tests/specs/metadata/Content_GFM.meta.txt: -------------------------------------------------------------------------------- 1 | 2 | Header 3 | 4 | simple paragraph: emph, strong, strike and mono. 5 | 6 | " 7 | quote 8 | " 9 | 10 | code block 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | link 19 | 20 | [image] 21 | 22 | link-ref 23 | 24 | [image-ref] 25 | 26 | ---------- 27 | 28 | * List 29 | * Sub item 1 30 | * Sub item 2 31 | 32 | * Item 2 33 | * Sub item 1 34 | 35 | 36 | * Ordered List 37 | * Sub item 1 38 | 39 | * Item 2 40 | * Sub item 1 41 | 42 | head 1 head 2 head 3 head 4 -------------------------------------------------------------------------------- /tests/specs/without-htmlok/Content.md: -------------------------------------------------------------------------------- 1 | # Header 2 | 3 | Inline HTML: 4 | 5 | deleted 6 | 7 | 8 | -------------------------------------------------------------------------------- /tests/specs/without-htmlok/Content_GFM.html: -------------------------------------------------------------------------------- 1 |

Header

2 | 3 |

4 | Inline HTML: 5 |

6 | 7 |

8 | <del>deleted</del> 9 |

10 | -------------------------------------------------------------------------------- /tests/specs/without-htmlok/Content_MarkdownExtra.html: -------------------------------------------------------------------------------- 1 |

Header

2 | 3 |

4 | Inline HTML: 5 |

6 | 7 |

8 | <del>deleted</del> 9 |

10 | -------------------------------------------------------------------------------- /tests/specs/without-htmlok/Content_Traditional.html: -------------------------------------------------------------------------------- 1 |

Header

2 | 3 |

4 | Inline HTML: 5 |

6 | 7 |

8 | <del>deleted</del> 9 |

10 | --------------------------------------------------------------------------------