GithubHelp home page GithubHelp logo

md4qt's People

Contributors

igormironchik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

light-wizzard

md4qt's Issues

Parser (still) seg-faults when presented with not-well-formed/invalid HTML

Parsing following string causes a segfault:

"# Radiated 1G-6G\nMeasured in GTEM using 12 Faces Method.\n<foo>\n## Results\n![Measurement Result](MeasurementResult)\n\n<Peaklist>\n<bar>\n\n## Observation\nNo relevant emissions other than radio transmissions.\n\n## Images\n"

<foo> does not harm (for some reason).
<Peaklist> gets replaced with some table. If this fails, it seg-faults.
To verify this, I added <bar>. This also seg-faults.

Closing the tag removes the seg-fault.
Just for reference, I opted to use "<...>" for my custom tags... those get (mostly) replaced by some MD data.

seg-fault happens here:

template< class Trait >
inline typename Delims< Trait >::const_iterator
finishRule7HtmlTag( typename Delims< Trait >::const_iterator it,
	typename Delims< Trait >::const_iterator last,
	TextParsingOpts< Trait > & po )
{
	const auto start = it;
	long long int l = -1, p = -1;
	bool onLine = false;
	bool ok = false;

	std::tie( ok, l, p, onLine, std::ignore ) = isHtmlTag( it->m_line, it->m_pos,
		po, 7 );

Locals:

	Lokale Variablen		
		it	@0x7fffffffb048	QList::const_iterator
		l	-1	long long
		last	@0x7fffffffb040	QList::const_iterator
		ok	false	bool
		onLine	false	bool
		p	-1	long long
		po	@0x7fffffffb210	MD::TextParsingOpts &
		start	@0x7fffffffb058	QList::const_iterator

Callstack:

                                                                                                                                                                                                                                                                                                             
1   MD::finishRule7HtmlTag                                                                                                                                                                                                                                   parser.hpp                  4240 0x55555584a49b 
2   MD::finishRawHtmlTag                                                                                                                                                                                                                                     parser.hpp                  4092 0x55555583bae7 
3   MD::parseFormattedText                                                                                                                                                                                                                                   parser.hpp                  6435 0x555555831df2 
4   MD::Parser::parseFormattedTextLinksImages                                                                                                                                                                                                                parser.hpp                  6478 0x555555823463 
5   MD::Parser::parseParagraph                                                                                                                                                                                                                               parser.hpp                  2532 0x555555820849 
6   MD::Parser::parseText                                                                                                                                                                                                                                    parser.hpp                  1958 0x555555812754 
7   MD::Parser::parseFragment                                                                                                                                                                                                                                parser.hpp                  1844 0x555555807333 
8   MD::Parser::parse(MD::StringListStream&, std::shared_ptr>, std::shared_ptr>, QList&, QString const&, QString const&, bool, bool)::{lambda()#1}::operator()() const parser.hpp                  1118 0x5555557fd05f 
9   MD::Parser::parse                                                                                                                                                                                                                                        parser.hpp                  1356 0x5555557fee5a 
10  MD::Parser::parseStream                                                                                                                                                                                                                                  parser.hpp                  1650 0x5555557f85e1 
11  MD::Parser::parse                                                                                                                                                                                                                                        parser.hpp                  834  0x5555557facc8 
12  MeasurementResultViewer::updateDoc                                                                                                                                                                                                                                         measurementresultviewer.cpp 430  0x5555557bdcd4 
13  MeasurementResultViewer::MeasurementResultViewer                                                                                                                                                                                                                           measurementresultviewer.cpp 194  0x5555557bb973 
14  WorkflowResults::showResults                                                                                                                                                                                                                                               workflowresults.cpp         255  0x5555559ccff0 
15  WorkspaceExplorer::mouseDoubleClickEvent                                                                                                                                                                                                                                   workspaceexplorer.cpp       76   0x555555895e72 
16  QWidget::event(QEvent *)                                                                                                                                                                                                                                                                                    0x7ffff77bd28b 
17  QFrame::event(QEvent *)                                                                                                                                                                                                                                                                                     0x7ffff784f8f6 
18  QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject *, QEvent *)                                                                                                                                                                                                                                 0x7ffff653a168 
19  QApplicationPrivate::notify_helper(QObject *, QEvent *)                                                                                                                                                                                                                                                     0x7ffff777135b 
20  QApplication::notify(QObject *, QEvent *)                                                                                                                                                                                                                                                                   0x7ffff7773c79 
...                                                                                                                                                                                                                                                                                                                      

Can you show an example of opening a markdown file and saving as an html file

Looking at your example it seems I need to cast to get the information in the iterator (it) you use, would I also need to make a case for each type?

There must be a better way, but I did not figure it out.

I want to use this in a Qt Desktop C++ Widget App, in an editor, so I want to pass in the text and not the file name and return the text, I started off by using the Qt example for the Markdown editor, but it is way too slow, it uses JavaScript.

Most code I have seen only deals with files, which means I have to save the file, every time I enter a character so that I can update the HTML previewer, which is a Web Engine Widget, so I will have to write a wrapper around them to deal with this issue because this makes the editor GUI slow, plus the hourglass for saves, so I need figure out a better solution, and why I am looking at your code instead of C, only thing is your example does not help me much.

The App I am working on is at https://github.com/Light-Wizzard/QtWidgetCpackInstaller, the app is just an Editor, and the focus is on deploying this application using cmake, cpack, and NSIS, in this case, I want to use your parser to keep this a Qt example application for deploying Web Engine enabled apps.

The Qt Web Engine Widget Markdown editor uses a JavaScript implementation that is too slow, I would have to figure out how to replace that parser with yours, to know how much faster it is, my guess is that it will be fast enough.

Thanks for any help.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.