summaryrefslogtreecommitdiffstats
path: root/src/markdown.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Confusing debug output for markdownalbert-github2021-05-111-3/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When having debug output one expects to have an overview what goes into the markdown processor and comes out of it. For markdown this happens but there can be a small step in front of it (page handling) and than the input is confusing as some processing already took place. When having a file aa.md: ``` This is a .md file ``` we get with `doxygen -d markdown`: ``` ======== Markdown ========= ---- input ------- @page md_aa aa\ilinebr This is a .md file ---- output ----- @page md_aa aa\ilinebr This is a .md file ========= ``` whilst it would be less confusing when we have: ``` ======== Markdown ========= ---- input ------- This is a .md file ---- output ----- @page md_aa aa\ilinebr This is a .md file ========= ```
* Merge branch 'master' into feature/bug_formula_mjDimitri van Heesch2021-04-281-72/+70
|\
| * Fix issue with test 055 on CygwinDimitri van Heesch2021-04-251-3/+1
| | | | | | | | - stored value was overwritten probably due to compiler optimisation bug
| * Refactoring: remove implicit conversion from QCString to const char *Dimitri van Heesch2021-04-221-69/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit changes the following in relation to string use - The implicit convert from 'QCString' to 'const char *' is removed - Strings parameters use 'const QCString &' as much as possible in favor over 'const char *' - 'if (s)' where s is a QCString has been replaced by 'if(!s.isEmpty())' - data() now always returns a valid C-string and not a 0-pointer. - when passing a string 's' to printf and related functions 'qPrint(s)' is used instead of 's.data()' - for empty string arguments 'QCString()' is used instead of '0' - The copy() operation has been removed - Where possible 'qstrcmp(a,b)==0' has been replaces by 'a==b' and 'qstrcmp(a,b)<0' has been replaced by 'a<b' - Parameters of string type that were default initialized with '= 0' are no initialized with '= QCString()'
* | Problems with some commands in MathJaxalbert-github2021-04-201-0/+5
|/ | | | | Especially with commands like `\f$\mbox{\LaTeX}\f$`MathJax has some problem as it is not, yet, able to use the commands `\raise` and `lower` inside the `\mbox` as used in this LaTeX command. Also switching in and out of math-mode doesn't work as the resulting code either doesn't work in MathJax or in LaTeX, hence the new command s `\f(` and `\f)`.
* Refactoring: Add TextStream buffer to improve output writing performanceDimitri van Heesch2021-03-281-1/+1
| | | | | - direct use of std::stringstream and std::ostream gave a 30% drop in performance.
* Fix for Linux build (missing #include <atomic>)Dimitri van Heesch2021-03-261-0/+1
|
* issue #8375: Lowercase search does not find non-ASCII uppercase pages and ↵Dimitri van Heesch2021-03-221-10/+9
| | | | vice versa
* Refactoring: replace QFile/FTextStream with fstream/stringstreamDimitri van Heesch2021-03-181-1/+1
|
* Refactoring: Replaced QFileInfo with FileInfoDimitri van Heesch2021-03-181-9/+10
| | | | | - FileInfo is based on ghc::filesystem, a std::filesystem compatible implementation that does not require C++17.
* Refactoring: some cleanup and removed text direction logicDimitri van Heesch2021-03-041-1/+0
|
* Refactoring: replaced std::regex with own much faster implementationDimitri van Heesch2021-03-021-5/+5
|
* Some performance tweaks + remove setting of global localeDimitri van Heesch2021-02-221-1/+1
|
* Refactoring: replace QRegExp by std::regex in markdown.cppDimitri van Heesch2021-02-201-10/+10
|
* issue_8362 Text of image repeated 4 timesalbert-github2021-01-291-2/+22
| | | | | | | | | | | | In case we have in markdown image definition like: ``` !["Image 1"](img/structure.png) ``` This would result, besides the image in the text: ``` Image 1""Image 1""Image 1""Image 1"" ``` due to the fact that besides the HTML image also the image code for other output formats (latex, rtf, docbook) was written and the double quote was not escaped properly.
* issue #8308 Verbatim block followed by markdown header breaks verbatim blockalbert-github2021-01-071-1/+35
| | | | Skip block commands.
* Incorrect entries on treeviewalbert-github2021-01-051-1/+1
| | | | | | | | | | | | | When having e.g. markdown files like: ``` 0.3.1.md 0.3.2.md ``` we get in the treeview twice the item "0" instead of the, more, expected "0.3.1" and "0.3.2". This is due to the fact that the filename is seen as `0` and the extension `.3.1.md` and `.3.2.md` instead of filename `0.3.1` and `0.3.2` and extension in both cases `.md`. The problem was found by Fossies in the Buildbot project.
* Miscounting lines in case a fenced code blockalbert-github2020-12-261-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When having the following code: ``` # The page ~~~ ABC ~~~ ~~~ DEF ~~~ ~~~ GHI ~~~ ~~~ JKL~~~ \line17 ``` we get the warnings: ``` .../aa.md:16: warning: Found unknown command '\line17' ``` instead of ``` .../aa.md:17: warning: Found unknown command '\line17' ``` The last character of the fenced code block is not handled in the code block. This problem has been solved (and also checked against the previous examples of #8045 and #8123).
* Miscounting of lines in case of inserting an anchor for a "H." tagalbert-github2020-12-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When having a simple file like: ``` # The page # a section ##### a h5 section \error7 ``` we get as warning: ``` .../aa.md:8: warning: Found unknown command '\error7' ``` instead of ``` .../aa.md:7: warning: Found unknown command '\error7' ``` This is due to the fact that the ``` ##### a h5 section ``` is translated into: ``` \anchor autotoc_md2 <h5>a h5 section</h5> ``` instead of ``` \anchor autotoc_md2\ilinebr <h5>a h5 section</h5> ```
* issue #8251: Macro stopped working in 1.8,.19Dimitri van Heesch2020-12-151-4/+9
|
* Optimized the escape function and made it more genericDimitri van Heesch2020-11-051-6/+7
|
* issue #8156 Markdown anchors do not work with special symbolsalbert-github2020-11-031-1/+7
| | | | Replace the respective characters by an underscore.
* Merge pull request #8131 from albert-github/feature/issue_8130Dimitri van Heesch2020-10-281-2/+6
|\ | | | | issue #8130 Markdown relative links - not working for other folders
| * issue #8130 Markdown relative links - not working for other foldersalbert-github2020-10-261-2/+6
| | | | | | | | Always convert links to absolute path even when path exists
* | issue #8132 Markdown inclusion of images broken after 39db9f48albert-github2020-10-261-0/+4
|/ | | | see to it that the `\ilinebr` cannot be seen as part of the file name (backslashes can be present as path especially in case of windows).
* Merge pull request #8123 from albert-github/feature/bug_cnt_md_codeDimitri van Heesch2020-10-241-1/+1
|\ | | | | Miscounting lines with markdown backtick section
| * Miscounting lines with markdown backtick sectionalbert-github2020-10-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When we have a program like: ``` # test ~~~ npm ~~~ \aa5 ~~~ npm ~~~ \aa8 ``` we get the warnings like: ``` .../aa.md:6: warning: Found unknown command '\aa5' .../aa.md:10: warning: Found unknown command '\aa8' ``` instead of: ``` .../aa.md:5: warning: Found unknown command '\aa5' .../aa.md:8: warning: Found unknown command '\aa8' ``` This has been corrected. Note: in the example tildes are used so the backticks show up in the github issue as well.
* | Merge pull request #8125 from albert-github/feature/bug_cnt_md_tableDimitri van Heesch2020-10-241-4/+4
|\ \ | | | | | | Miscounting lines with markdown table
| * | Miscounting lines with markdown tablealbert-github2020-10-221-4/+4
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When we have a program like: ``` # Test1 | \aa3 | | ---- | | \aa5 | \aa6 ``` we get the warnings like: ``` .../cc.md:3: warning: Found unknown command '\aa3' .../cc.md:4: warning: Found unknown command '\aa5' .../cc.md:6: warning: Found unknown command '\aa6' ``` instead of: ``` .../cc.md:4: warning: Found unknown command '\aa3' .../cc.md:5: warning: Found unknown command '\aa5' .../cc.md:6: warning: Found unknown command '\aa6' ``` The external counting was correct, not the internal counting. This has been corrected.
* | Miscounting lines with markdown blockquotealbert-github2020-10-221-3/+3
|/ | | | | | | | | | | | | | | | | | | | | | | When we have a program like: ``` # test \aa2 > \aa3 \aa4 ``` we get the warnings like: ``` .../aa.md:2: warning: Found unknown command '\aa2' .../aa.md:4: warning: Found unknown command '\aa3' .../aa.md:6: warning: Found unknown command '\aa4' ``` instead of: ``` .../aa.md:2: warning: Found unknown command '\aa2' .../aa.md:3: warning: Found unknown command '\aa3' .../aa.md:4: warning: Found unknown command '\aa4' ``` This has been corrected.
* Merge pull request #8114 from albert-github/feature/bug_cnt_md_extra_lineDimitri van Heesch2020-10-201-3/+7
|\ | | | | Miscounting in case of markdown wanted newline due to spaces at end of line
| * Update markdown.cppDimitri van Heesch2020-10-201-1/+1
| | | | | | Added size check
| * When we have some simple markdown files like with extra spaces (after ↵albert-github2020-10-181-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `\aa2`, `\bb2` and `\ccs2` to give in markdown a newline): ``` First test: 2 extra spaces after first line with error no extra empty lines \aa2 \aa3 ``` and ``` First test: 2 extra spaces after first line with error one extra empty line \bb2 \bb4 ``` and ``` First test: 2 extra spaces after first line with error two extra empty lines \cc2 \cc5 ``` we get warnings like: ``` .../aa.md:2: warning: Found unknown command '\aa2' .../aa.md:4: warning: Found unknown command '\aa3' .../bb.md:2: warning: Found unknown command '\bb2' .../bb.md:5: warning: Found unknown command '\bb4' .../cc.md:2: warning: Found unknown command '\cc2' .../cc.md:6: warning: Found unknown command '\cc5' ``` whilst this should be: ``` .../aa.md:2: warning: Found unknown command '\aa2' .../aa.md:3: warning: Found unknown command '\aa3' .../bb.md:2: warning: Found unknown command '\bb2' .../bb.md:4: warning: Found unknown command '\bb4' .../cc.md:2: warning: Found unknown command '\cc2' .../cc.md:5: warning: Found unknown command '\cc5' ``` This has been corrected by placing the `<br>` straight after the extra spaces and by not adding an extra newline.
* | Merge pull request #8117 from albert-github/feature/bug_cnt_md_ref_imageDimitri van Heesch2020-10-201-1/+1
|\ \ | | | | | | Miscounting of line in case of markdown `\ref` image
| * | Miscounting of line in case of markdown `\ref` imagealbert-github2020-10-191-1/+1
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In case we have: ``` The page \aa2 Doxygen's Doxygen Documentation: <a href="https://codedocs.xyz/doxygen/doxygen/"><img src="https://codedocs.xyz/doxygen/doxygen.svg"/></a>\aa2 \aa3 \aa4 ![Caption text](@ref https://codedocs.xyz/doxygen/doxygen.svg) \aa4 \aa5 ![Caption text](@ref https://codedocs.xyz/doxygen/doxygen.svg) \aa9 ``` we get the warnings: ``` .../aa.md:2: warning: Found unknown command '\aa2' .../aa.md:2: warning: Found unknown command '\aa2' .../aa.md:3: warning: Found unknown command '\aa3' .../aa.md:4: warning: Found unknown command '\aa4' .../aa.md:8: warning: Found unknown command '\aa4' .../aa.md:9: warning: Found unknown command '\aa5' .../aa.md:17: warning: Found unknown command '\aa9' ``` instead of the expected ``` .../aa.md:2: warning: Found unknown command '\aa2' .../aa.md:2: warning: Found unknown command '\aa2' .../aa.md:3: warning: Found unknown command '\aa3' .../aa.md:4: warning: Found unknown command '\aa4' .../aa.md:4: warning: Found unknown command '\aa4' .../aa.md:5: warning: Found unknown command '\aa5' .../aa.md:9: warning: Found unknown command '\aa9' ``` this is due to the fact that the markdown convertor adds some extra line wit `\n` instead of an internal line break `\ilinebr`.
* | Miscounting in markdown in case of a horizontal ruler.albert-github2020-10-181-1/+1
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When having code like: ``` A horizonal ruler by means of underscores \aa2 ____ \aa4 A horizonal ruler by means of hyphens \bb7 - --- \bb9 A horizonal ruler by means of asterisks \cc12 **** \cc14 ``` we get wanungs like: ``` .../aa.md:2: warning: Found unknown command '\aa2' .../aa.md:5: warning: Found unknown command '\aa4' .../aa.md:8: warning: Found unknown command '\bb7' .../aa.md:11: warning: Found unknown command '\bb9' .../aa.md:14: warning: Found unknown command '\cc12' .../aa.md:17: warning: Found unknown command '\cc14' ``` instead of ``` .../aa.md:2: warning: Found unknown command '\aa2' .../aa.md:4: warning: Found unknown command '\aa4' .../aa.md:7: warning: Found unknown command '\bb7' .../aa.md:9: warning: Found unknown command '\bb9' .../aa.md:12: warning: Found unknown command '\cc12' .../aa.md:14: warning: Found unknown command '\cc14' ``` This has been fixed.
* Fix for compiler warning fix :-(Dimitri van Heesch2020-10-171-1/+1
|
* Fixes compiler warningDimitri van Heesch2020-10-171-1/+1
|
* Miscounting in case of markdown linksalbert-github2020-10-161-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When we have simple input files like: ``` Chrome's trace viewer (Catapult) following the [instructions]( https://chromium.googlesource.com/catapult/+/refs/heads/master/tracing/docs/embedding-trace-viewer.md). This directory contains the helper files to embed Chrome's trace viewer. The current resources were generated/copied from [`Catapult@9508452e18f130c98499cb4c4f1e1efaedee8962` ]( https://chromium.googlesource.com/catapult/+/9508452e18f130c98499cb4c4f1e1efaedee8962). \aa11 ``` or ``` Add new exported module Text.Pandoc.Writers.AnnotatedTable [API change] (#6655, Christian Despres). This module (which should generally \bb3 ``` one gets (in the current master version, a5ac10888f6c0b0fc00678f67aa49036b33aa4cf): ``` .../aa.md:8: warning: Found unknown command '\aa11' .../bb.md:3: warning: Found unknown command '\bb4' ``` instead of ``` .../aa.md:11: warning: Found unknown command '\aa11' .../bb.md:4: warning: Found unknown command '\bb4' ``` this is due to the fact that the newlines inside the links are not taken into consideration during the conversion. We can add the extra newlines but have to do this inside the `<...>` as than they are handled correctly later on: - when adding them before the `<` doxygen sees a newline and will start a new paragraph starting with the link instead of keeping it in its place. - when adding them after the `>` we can get a warning about `warning: End of list marker found without any preceding list items` when after the closing `)` of the link there is directly a `.`
* Merge pull request #8079 from albert-github/feature/issue_8078Dimitri van Heesch2020-10-121-1/+1
|\ | | | | issue #8078 Warning and extra text when using Markdown as mainpage
| * issue #8078 Warning and extra text when using Markdown as mainpagealbert-github2020-10-061-1/+1
| | | | | | | | Also replace the `@` in a label.
* | Miscounting of lines in respect to page command (ATX header)albert-github2020-10-101-0/+1
| | | | | | | | | | | | | | | | | | | | In case of an ATX header for a page at the beginning of a file (i.e. `#...`) there is a line miscounting. Analogous as done for lines type: ``` The page ==== ``` in pull request #8056 we have to add an extra newline.
* | Incorrect counting of markdown verbatim blockalbert-github2020-10-081-1/+2
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When we have a file aa.md like: ``` Initial text 1 verbatim text? Some text \aa5 ``` and a file bb.md like ``` Initial text 1 verbatim text? Some text \aa4 `` we get the warnings like (with current master, with 1.8.20 it is even further off): ``` aa.md:6: warning: Found unknown command '\aa5' bb.md:5: warning: Found unknown command '\aa4' ``` instead of ``` aa.md:5: warning: Found unknown command '\aa5' bb.md:4: warning: Found unknown command '\aa4' ``` This has been corrected
* added support for mingw PRETTY_FUNC (#8059)ArmandZampieri2020-10-051-1/+1
| | | | | | | | | * added support for mingw PRETTY_FUNC * More compact Define test for PRETTY_FUNCTION * corrected synthax issue Co-authored-by: ZAMPIERI Armand <armand.zampieri@cmigroupe.com>
* Merge branch 'feature/bug_md_pg_cnt' of ↵Dimitri van Heesch2020-10-031-17/+19
|\ | | | | | | https://github.com/albert-github/doxygen into albert-github-feature/bug_md_pg_cnt
| * Miscounting of lines in respect to page commandalbert-github2020-09-241-17/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | All examples together are a bit big so they are all in the attached file together with the warnings before and after this patch. When looking at the output we see that a number of lines are off by 1 ore more due to the insertion of extra lines in the code or due to the fact that there is a reference to the start of the documentation of the page and not the line of the page command. - commentscan.l in case of a rule contaiinge {DOCNL} this can be `=n` or `\ilinebr` in the later case this should not be replaced by `\n` as this results in an increase of the line count later on. in case of a page like command also register the line of the command as "topline". - entry.h, entry.cpp storage space for the "topline" registering the line of the page like commands. - doxygen.cpp setting and using the "topline" - markdown.cpp, markdown.h don't add a `\n` as this increases the line count but use the `\ilinebr` to get correct warnings see to it that when having empty lines at the top of the page and a page is added that the empty lines appear after the page command. - index.cpp using the "topline" instead of the "docLine" to get the correct warning - pagedef.cpp, pagedef.h set and retrieve the "topline" for page like commands. - util.cpp, util.h setting and using the "topline" in `addRelatedPage` use the known file name and line for the warning regarding the section label - cite.cpp, context.cpp, reflist.cpp changed to have good function calls.
* | No warning for unbalanced brackets in markdownalbert-github2020-09-251-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When we have the input files qq.md. ``` @page xxx0 yyy0 @} Start of text @page xxx1 yyy1 @{ Start of text ``` and qqh.h: ``` /** @page xxxh0 yyyh0 @} Start of texth */ /** @page xxxh1 yyyh1 @{ Start of texth */ ``` we get the warnings: ``` qq.md:3: warning: unbalanced grouping commands qqh.h:4: warning: unbalanced grouping commands qqh.h:15: warning: end of file with unbalanced grouping commands ``` ``` so we are missing ``` qq.md:9: warning: end of file with unbalanced grouping commands ``` due to the fact that the closing routine was not called (also the open routine was not called, always good to call it the set variables to their proper values.
* | Merge pull request #8045 from albert-github/feature/bug_md_fenced_cntDimitri van Heesch2020-09-241-1/+1
|\ \ | |/ |/| Miscounting of lines in case of fenced code block
| * Miscounting of lines in case of fenced code blockalbert-github2020-09-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When we have an example like: ~~~ Page ======= test text test text \error1 ``` make ``` ``` make ``` test text \error2 ~~~ we get the warnings: ``` aa.md:5: warning: Found unknown command '\error1' aa.md:17: warning: Found unknown command '\error2' ``` instead of ``` aa.md:5: warning: Found unknown command '\error1' aa.md:15: warning: Found unknown command '\error2' ``` this is due to the fact that there are 2 returns in case of a fenced code block, one with the ``endcode` but with the detection of the fenced code block (`isFencedCodeBlock`) it is not "removed".
* | issue #8037: Links using @ref stopped working in doxygen 1.8.19Dimitri van Heesch2020-09-211-0/+1
|/