harbour-nextcloudnotes/qml/pages/SyntaxPage.qml

399 lines
32 KiB
QML
Raw Permalink Normal View History

import QtQuick 2.0
import Sailfish.Silica 1.0
Page {
id: page
2018-12-13 01:10:45 +03:00
SilicaFlickable {
id: mainFlickable
anchors.fill: parent
contentHeight: column.height + Theme.paddingLarge
2018-12-11 19:44:00 +03:00
2018-12-13 01:10:45 +03:00
PullDownMenu {
MenuItem {
text: qsTr("View more on the web")
onClicked: Qt.openUrlExternally("https://github.com/showdownjs/showdown/wiki/Showdown's-Markdown-syntax")
2018-12-11 19:44:00 +03:00
}
2018-12-13 01:10:45 +03:00
MenuItem {
id: resetMenuItem
property bool allOpened: false
text: allOpened ? qsTr("Close previews") :
qsTr("Open previews")
onClicked: allOpened = !allOpened
2018-12-11 19:44:00 +03:00
}
}
Column {
id: column
width: parent.width
PageHeader {
title: qsTr("Markdown Syntax")
}
2018-12-13 01:10:45 +03:00
Loader {
sourceComponent: syntaxDrawer
property string title: qsTr("Paragraphs")
property string description: qsTr("Paragraphs in Showdown are just one or more lines of consecutive text followed by one or more blank lines.")
property string rawText:
"On July 2, an alien mothership entered Earth's orbit and deployed several dozen
saucer-shaped \"destroyer\" spacecraft, each 15 miles (24 km) wide.
On July 3, the Black Knights, a squadron of Marine Corps F/A-18 Hornets,
participated in an assault on a destroyer near the city of Los Angeles."
property string convertedText:
"<p>On July 2, an alien mothership entered Earth's orbit and deployed several dozen<br />
saucer-shaped \"destroyer\" spacecraft, each 15 miles (24 km) wide.</p>
<p>On July 3, the Black Knights, a squadron of Marine Corps F/A-18 Hornets,<br />
participated in an assault on a destroyer near the city of Los Angeles.</p>"
}
Loader {
sourceComponent: syntaxDrawer
property string title: qsTr("Headings")
property string description: qsTr("You can create a heading by adding one or more # symbols before your heading text. The number of # you use will determine the size of the heading.")
property string rawText:
"# The largest heading (an <h1> tag)
## The second largest heading (an <h2> tag)
### The third largest heading (an <h3> tag)
#### The 4th largest heading (an <h4> tag)
##### The 5th largest heading (an <h5> tag)
###### The 6th largest heading (an <h6> tag)"
property string convertedText:
"<h1 id=\"thelargestheadinganh1tag\">The largest heading (an \&lt;h1> tag)</h1>
<h2 id=\"thesecondlargestheadinganh2tag\">The second largest heading (an \&lt;h2> tag)</h2>
<h3 id=\"thethirdlargestheadinganh3tag\">The third largest heading (an \&lt;h3> tag)</h3>
<h4 id=\"the4thlargestheadinganh4tag\">The 4th largest heading (an \&lt;h4> tag)</h4>
<h5 id=\"the5thlargestheadinganh5tag\">The 5th largest heading (an \&lt;h5> tag)</h5>
<h6 id=\"the6thlargestheadinganh6tag\">The 6th largest heading (an \&lt;h6> tag)</h6>"
}
2018-12-11 19:44:00 +03:00
Loader {
sourceComponent: syntaxDrawer
2018-12-13 01:10:45 +03:00
property string description: qsTr("If, for some reason, you need to keep a leading or trailing #, you can either add a space or escape it:")
property string rawText:
"# # My header # #
# \\# My Header \\# #"
property string convertedText:
"<h1 id=\"myheader\"># My header #</h1>
<h1 id=\"myheader-1\"># My Header #</h1>"
2018-12-11 19:44:00 +03:00
}
2018-12-13 01:10:45 +03:00
Loader {
sourceComponent: syntaxDrawer
property string title: qsTr("Blockquotes")
property string description: qsTr("You can indicate blockquotes with a >.")
property string rawText:
"In the words of Abraham Lincoln:
> Pardon my french"
property string convertedText:
"<p>In the words of Abraham Lincoln:</p>
<blockquote>
<p>Pardon my french</p>
</blockquote>"
}
Loader {
sourceComponent: syntaxDrawer
property string title: qsTr("Bold and Italic")
property string description: qsTr("You can make text bold or italic.")
property string rawText:
"*This text will be italic*
**This text will be bold**"
property string convertedText:
"<p><em>This text will be italic</em><br />
<strong>This text will be bold</strong></p>"
}
Loader {
sourceComponent: syntaxDrawer
property string description: qsTr("Both bold and italic can use either a * or an _ around the text for styling. This allows you to combine both bold and italic if needed.")
property string rawText:
"**Everyone _must_ attend the meeting at 5 o'clock today.**"
property string convertedText:
"<p><strong>Everyone <em>must</em> attend the meeting at 5 o'clock today.</strong></p>"
}
Loader {
sourceComponent: syntaxDrawer
property string title: qsTr("Strikethrough")
property string description: qsTr("The syntax is the same as GFM, that is, by adding two tilde (~~) characters around a word or groups of words.")
property string rawText:
"a ~~strikethrough~~ element"
property string convertedText:
"<p>a <del>strikethrough</del> element</p>"
2018-12-11 19:44:00 +03:00
}
2018-12-13 01:10:45 +03:00
Loader {
sourceComponent: syntaxDrawer
property string title: qsTr("Emojis")
property string description: qsTr("Since version 1.8.0, showdown supports github's emojis. A complete list of available emojis can be found here: https://github.com/showdownjs/showdown/wiki/emojis.")
property string rawText:
"this is a :smile: smile emoji"
property string convertedText:
"<p>this is a &#128578; smile emoji</p>"
}
Loader {
sourceComponent: syntaxDrawer
property string title: qsTr("Code formatting")
property string description: qsTr("Use single backticks (`) to format text in a special monospace format. Everything within the backticks appear as-is, with no other special formatting.")
property string rawText:
"Here's an idea: why don't we take `SuperiorProject` and turn it into `**Reasonable**Project`."
property string convertedText:
"<p>Here's an idea: why don't we take <code>SuperiorProject</code> and turn it into <code>**Reasonable**Project</code>.</p>"
}
Loader {
sourceComponent: syntaxDrawer
property string description: qsTr("To create blocks of code you should indent it by four spaces.")
property string rawText:
" this is a piece
of
code"
property string convertedText:
"<pre><code>this is a piece
of
code
</code></pre>"
}
2018-12-11 19:44:00 +03:00
Loader {
sourceComponent: syntaxDrawer
2018-12-13 01:10:45 +03:00
property string title: qsTr("Lists")
property string description: qsTr("You can make an unordered list by preceding list items with either a *, a - or a +. Markers are interchangeable too.")
property string rawText:
"* Item
+ Item
- Item"
property string convertedText:
"<ul>
<li>Item</li>
<li>Item</li>
<li>Item</li>
</ul>"
}
Loader {
sourceComponent: syntaxDrawer
property string description: qsTr("You can make an ordered list by preceding list items with a number.")
property string rawText:
"1. Item 1
2. Item 2
3. Item 3"
property string convertedText:
"<ol>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ol>"
}
Loader {
sourceComponent: syntaxDrawer
property string description: qsTr("TaskLists")
property string rawText:
"- [x] checked list item
- [ ] unchecked list item"
property string convertedText:
"<ul>
<li class=\"tasklist\"><a class=\"checkbox\" href=\"tasklist:uncheckbox_0\"> checked list item</a></li>
<li class=\"tasklist\"><a class=\"checkbox\" href=\"tasklist:checkbox_0\"> unchecked list item</li>
</ul>"
}
Loader {
sourceComponent: syntaxDrawer
property string title: qsTr("Links")
property string description: qsTr("Showdown will automagically turn every valid URL it finds in the text body to links for you. In the case of email addreses, Showdown will also perform a bit of randomized decimal and hex entity-encoding to help obscure your address from address-harvesting spambots.")
property string rawText:
"https://jolla.com
2018-12-11 19:44:00 +03:00
info@jolla.com
[Homepage - Jolla](https://jolla.com)
[Link to Jolla][1]
[jolla][]
[1]: https://jolla.com
[jolla]: https://jolla.com"
2018-12-13 01:10:45 +03:00
property string convertedText:
"<p><a href=\"https://jolla.com\">https://jolla.com</a><br />
<a href=\"&#109;&#97;&#105;&#108;&#x74;&#x6f;&#58;&#105;&#110;&#x66;&#x6f;&#64;&#106;&#111;&#108;&#x6c;a&#46;c&#111;&#109;\">&#105;&#110;&#102;&#111;&#x40;&#x6a;&#x6f;&#x6c;&#x6c;&#x61;&#46;&#x63;&#111;&#x6d;</a><br />
<a href=\"https://jolla.com\">Homepage - Jolla</a><br />
<a href=\"https://jolla.com\">Link to Jolla</a><br />
<a href=\"https://jolla.com\">jolla</a></p>"
2018-12-11 19:44:00 +03:00
}
2018-12-13 01:10:45 +03:00
Loader {
sourceComponent: syntaxDrawer
property string title: qsTr("Images")
property string description: qsTr("Markdown uses an image syntax that is intended to resemble the syntax for links, also allowing for two styles: inline and reference.")
property string rawText:
"![Alt text](https://cloud.scharel.name/s/harbour-nextcloudnotes/download?path=/&files=nextcloud-logo-transparent.png \"Optional title\")
![Alt text][img]
[img]:
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFYAAABWCAYAAABVVmH3AAAACXBIWXMAAA9hAAAPYQGoP6dpAAAWfUlEQVR4nOWdeXQbx33Hv7OLxX2QBMELBCkeoiiRFHVaimVdvi07TmMnTZPYytH4JU1eXpvXlyZu+9o4TXM4s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3XVvXuqpKEmthJIe9YsDleT4BluO47SmFXIaXCtcTDM32HG1aMjq93k0dDa7H3zinBoBAKCr78t07hsvS/ghSDbN7AvLHXz1bM+T0zKYRtSp5fH/bGted21rcuhw+F9KGfDGk68sAgBCyrRDDS4ErxuisoiCTzXsfZIzhhlbzzB/ODYTlPM/iDLPjrtTcGABeuzBc8syJy1VicgeMUpDRD1zX6rx9U6NHkPEFrX8V0oZ8NtKvOQAghGxODzRlOLMBmde5GppN36C+NnVx+4NZVy44Qtj9e9vHCQGTcWCPPH+qzu1P9PRsft3+sOy7z52wPHn0YnUK6qaGqplvffzGgTu3NLnTFxwLyWfka0MuycaHO3LkiAyAeSGGFwNXJfBxtSIx97S5/IpcNtrMxuD7t651AoA7EBK+98IpSyiaGJvTdXrtLtU//ubNxku2KS0AlGiU4hfv2D76pTuvGzPqrs0wCoFTbLiUUnDV1dUWALxUpWz3FwqX4zg0V5QEAaB3fForxijJZeMD25qnd7aYPQAw5vIpH37uRJ0/FOVTti+NTqq/98K1pZzrWy3ub31s3+C2pmp/tthWAy7H83x9vkrFgrtzXQJWICzyr14YLM2slxJCCD69b6NjvdnoB4Ahp0f1j
property string convertedText:
"<p><img src=\"https://cloud.scharel.name/s/harbour-nextcloudnotes/download?path=/&files=nextcloud-logo-transparent.png\" alt=\"Alt text\" title=\"Optional title\" /><br />
<img src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFYAAABWCAYAAABVVmH3AAAACXBIWXMAAA9hAAAPYQGoP6dpAAAWfUlEQVR4nOWdeXQbx33Hv7OLxX2QBMELBCkeoiiRFHVaimVdvi07TmMnTZPYytH4JU1eXpvXlyZu+9o4TXM4sZs4R1/cxHlJ49px0tSX4luyI8mSLMkSJUoiKV4gQRAESRzEjQVm+gcACgSBBUiCZNz+/lrszO+YDwezs7+ZAQn+hIQxJvN4PBYA9RzH1TLGDIQQNSFEDUADQJapw3Fc1mtCSEE+c+lL1ctz3wngicK8L5N4vV5jLBbbTgjZBmAz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PM/iDLPjrtTcGABeuzBc8syJy1VicgeMUpDRD1zX6rx9U6NHkPEFrX8V0oZ8NtKvOQAghGxODzRlOLMBmde5GppN36C+NnVx+4NZVy44Qtj9e9vHCQGTcWCPPH+qzu1P9PRsft3+sOy7z52wPHn0YnUK6qaGqplvffzGgTu3NLnTFxwLyWfka0MuycaHO3LkiAyAeSGGFwNXJfBxtSIx97S5/IpcNtrMxuD7t651AoA7EBK+98IpSyiaGJvTdXrtLtU//ubNxku2KS0AlGiU4hfv2D76pTuvGzPqrs0wCoFTbLiUUnDV1dUWALxUpWz3FwqX4zg0V5QEAaB3fForxijJZeMD25qnd7aYPQAw5vIpH37uRJ0/FOVTti+NTqq/98K1pZzrWy3ub31s3+C2pmp/tthWAy7H83x9vkrFgrtzXQJWICzyr14YLM2slxJCCD69b6Njvd
2018-12-11 19:44:00 +03:00
}
2018-12-13 01:10:45 +03:00
2018-12-11 19:44:00 +03:00
Loader {
sourceComponent: syntaxDrawer
2018-12-13 01:10:45 +03:00
property string title: qsTr("Tables")
property string description: qsTr("Tables aren't part of the core Markdown spec, but they are part of GFM and Showdown supports them by turning on the option tables.
Colons can be used to align columns.
In the new version, the outer pipes (|) are optional, matching GFM spec.
You also don't need to make the raw Markdown line up prettily.
You can also use other markdown syntax inside them.")
property string rawText:
"| Tables | Are | Cool |
| ------------- |:-------------:| -----:|
| **col 3 is** | right-aligned | $1600 |
| col 2 is | *centered* | $12 |
| zebra stripes | ~~are neat~~ | $1 |"
property string convertedText:
"<table border='1' cellpadding='20'>
2018-12-11 19:44:00 +03:00
<thead>
2018-12-13 01:10:45 +03:00
<tr>
<th>Tables</th>
<th style=\"text-align:center;\">Are</th>
<th style=\"text-align:right;\">Cool</th>
</tr>
2018-12-11 19:44:00 +03:00
</thead>
<tbody>
2018-12-13 01:10:45 +03:00
<tr>
<td><strong>col 3 is</strong></td>
<td style=\"text-align:center;\">right-aligned</td>
<td style=\"text-align:right;\">$1600</td>
</tr>
<tr>
<td>col 2 is</td>
<td style=\"text-align:center;\"><em>centered</em></td>
<td style=\"text-align:right;\">$12</td>
</tr>
<tr>
<td>zebra stripes</td>
<td style=\"text-align:center;\"><del>are neat</del></td>
<td style=\"text-align:right;\">$1</td>
</tr>
2018-12-11 19:44:00 +03:00
</tbody>
</table>"
}
2018-12-13 01:10:45 +03:00
Loader {
sourceComponent: syntaxDrawer
property string title: qsTr("HTML")
property string description: qsTr("In most cases, HTML tags are leaved untouched in the output document.")
property string rawText:
"some markdown **here**
<div>this is *not* **parsed**</div>
Use <b>HTML</b> <i>Tags</i> to format your text."
property string convertedText:
"<p>some markdown <strong>here</strong></p>
<div>this is *not* **parsed**</div>
<p>Use <b>HTML</b> <i>Tags</i> to format your text.</p>"
}
}
2018-12-13 01:10:45 +03:00
VerticalScrollDecorator { flickable: mainFlickable }
}
Component {
id: syntaxDrawer
Column {
width: page.width
SectionHeader {
text: title
}
Label {
x: Theme.horizontalPageMargin
width: parent.width - 2*x
bottomPadding: Theme.paddingLarge
wrapMode: Text.Wrap
color: Theme.secondaryColor
text: description
}
Separator {
width: parent.width
color: Theme.primaryColor
horizontalAlignment: Qt.AlignLeft
}
Drawer {
id: drawer
width: parent.width
height: rawTextLabel.height + 2*Theme.paddingLarge > 2*Theme.itemSizeHuge ? 2*Theme.itemSizeHuge : rawTextLabel.height + 2*Theme.paddingLarge
backgroundSize: height
hideOnMinimize: true
dock: Dock.Bottom
Connections {
target: resetMenuItem
onAllOpenedChanged: resetMenuItem.allOpened ? drawer.show() : drawer.hide()
}
foreground: SilicaFlickable {
id: rawTextFlickable
anchors.fill: parent
contentWidth: parent.width > rawTextLabel.contentWidth ? parent.width : rawTextLabel.contentWidth + 2*Theme.horizontalPageMargin
contentHeight: parent.height > rawTextLabel.height ? parent.height : rawTextLabel.height
BackgroundItem {
anchors.fill: parent
onClicked: drawer.show()
Label {
id: rawTextLabel
x: Theme.horizontalPageMargin
y: Theme.paddingLarge
color: parent.highlighted ? Theme.highlightColor : Theme.primaryColor
font.family: appSettings.useMonoFont ? "DejaVu Sans Mono" : Theme.fontFamily
textFormat: Text.PlainText
text: rawText
}
}
ScrollDecorator { /*flickable: rawTextFlickable*/ }
}
background: SilicaFlickable {
id: convertedTextFlickable
anchors.fill: parent
contentWidth: parent.width > convertedTextLabel.contentWidth ? parent.width : convertedTextLabel.contentWidth + 2*Theme.horizontalPageMargin
contentHeight: parent.height > convertedTextLabel.height ? parent.height : convertedTextLabel.height + 2*Theme.paddingLarge
BackgroundItem {
anchors.fill: parent
onClicked: drawer.hide()
LinkedLabel {
id: convertedTextLabel
x: Theme.horizontalPageMargin
y: Theme.paddingLarge
textFormat: Text.RichText
linkColor: Theme.primaryColor
defaultLinkActions: false
onLinkActivated: drawer.hide()
text: "<style>\n" +
"ul,ol,table,img { margin: " + Theme.paddingLarge + "px 0px; }\n" +
"a:link { color: " + Theme.primaryColor + "; }\n" +
"a.checkbox { text-decoration: none; padding: " + Theme.paddingSmall + "px; display: inline-block; }\n" +
"li.tasklist { font-size:large; margin: " + Theme.paddingMedium + "px 0px; }\n" +
"del { text-decoration: line-through; }\n" +
"table { border-color: " + Theme.secondaryColor + "; }\n" +
"</style>\n" + convertedText
}
}
ScrollDecorator { /*flickable: convertedTextFlickable*/ }
}
}
Separator {
width: parent.width
color: Theme.primaryColor
horizontalAlignment: Qt.AlignRight
}
}
}
allowedOrientations: defaultAllowedOrientations
}