Skip to content

Commit

Permalink
fix: "Markdown" text-case
Browse files Browse the repository at this point in the history
  • Loading branch information
pbek committed Dec 14, 2023
1 parent 711f551 commit 1c227d3
Show file tree
Hide file tree
Showing 17 changed files with 284 additions and 284 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@


[QOwnNotes](https://www.qownnotes.org) is the **open source notepad** with
[**markdown support**](https://github.com/pbek/QOwnNotes/blob/main/src/demonotes/Markdown%20Cheatsheet.md)
[**Markdown support**](https://github.com/pbek/QOwnNotes/blob/main/src/demonotes/Markdown%20Cheatsheet.md)
and **todo list manager** for **GNU/Linux**, **macOS** and **Windows**,
that works together with [**Nextcloud Notes**](https://github.com/Nextcloud/notes)
and [**ownCloud Notes**](https://github.com/owncloud/notes).
Expand Down
2 changes: 1 addition & 1 deletion default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ stdenv.mkDerivation {
'';

meta = with lib; {
description = "Plain-text file notepad and todo-list manager with markdown support and Nextcloud/ownCloud integration";
description = "Plain-text file notepad and todo-list manager with Markdown support and Nextcloud/ownCloud integration";
homepage = "https://www.qownnotes.org/";
changelog = "https://www.qownnotes.org/changelog.html";
downloadPage = "https://github.com/pbek/QOwnNotes/releases/tag/v${version}";
Expand Down
6 changes: 3 additions & 3 deletions src/dialogs/settingsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2141,7 +2141,7 @@ void SettingsDialog::on_reinitializeDatabaseButton_clicked() {
}

/**
* @brief Stores the debug information to a markdown file
* @brief Stores the debug information to a Markdown file
*/
void SettingsDialog::on_saveDebugInfoButton_clicked() {
Utils::Gui::information(this, tr("Debug information"),
Expand Down Expand Up @@ -2268,7 +2268,7 @@ void SettingsDialog::on_noteTextEditCodeResetButton_clicked() {
}

/**
* Resets the font for the note markdown view
* Resets the font for the note Markdown view
*/
void SettingsDialog::on_noteTextViewResetButton_clicked() {
QTextBrowser textView;
Expand All @@ -2277,7 +2277,7 @@ void SettingsDialog::on_noteTextViewResetButton_clicked() {
}

/**
* Resets the font for the note markdown code view
* Resets the font for the note Markdown code view
*/
void SettingsDialog::on_noteTextViewCodeResetButton_clicked() {
noteTextViewCodeFont = QFontDatabase::systemFont(QFontDatabase::FixedFont);
Expand Down
6 changes: 3 additions & 3 deletions src/dialogs/tabledialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ void TableDialog::updateMaxItems() {
}

/**
* Creates the table markdown code
* Creates the table Markdown code
*/
void TableDialog::on_buttonBox_accepted() {
switch (ui->tabWidget->currentIndex()) {
Expand All @@ -81,7 +81,7 @@ void TableDialog::on_buttonBox_accepted() {

default:
case Tab::CreateTab:
// create the markdown table
// create the Markdown table
createMarkdownTable();
break;
}
Expand Down Expand Up @@ -128,7 +128,7 @@ void TableDialog::importCSV() {
}

/**
* Creates the markdown table
* Creates the Markdown table
*/
void TableDialog::createMarkdownTable() {
if ((ui->rowSpinBox->value() == 0) || (ui->columnSpinBox->value() == 0)) {
Expand Down
2 changes: 1 addition & 1 deletion src/dialogs/welcomedialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<item row="1" column="0">
<widget class="QLabel" name="subHeadlineLabel">
<property name="text">
<string>plain-text file markdown note taking with ownCloud integration</string>
<string>Plain-text file Markdown note-taking with ownCloud integration</string>
</property>
<property name="wordWrap">
<bool>true</bool>
Expand Down
36 changes: 18 additions & 18 deletions src/entities/note.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1557,7 +1557,7 @@ bool Note::modifyNoteTextFileNameFromQMLHook() {
bool Note::handleNoteTextFileName() {
QString noteText = _noteText;

// remove frontmatter from start of markdown text
// remove frontmatter from start of Markdown text
if (noteText.startsWith(QLatin1String("---"))) {
static const QRegularExpression re(
QStringLiteral(
Expand All @@ -1566,7 +1566,7 @@ bool Note::handleNoteTextFileName() {
noteText.remove(re);
}

// remove html comment from start of markdown text
// remove html comment from start of Markdown text
if (noteText.startsWith(QLatin1String("<!--"))) {
static const QRegularExpression re(QStringLiteral(R"(^<!--.+?-->((\r\n)|(\n\r)|\r|\n))"),
QRegularExpression::DotMatchesEverythingOption);
Expand All @@ -1589,7 +1589,7 @@ bool Note::handleNoteTextFileName() {
return false;
}

// remove a leading "# " for markdown headlines
// remove a leading "# " for Markdown headlines
static const QRegularExpression headlinesRE(QStringLiteral("^#\\s"));
name.remove(headlinesRE);

Expand Down Expand Up @@ -1782,7 +1782,7 @@ QString Note::getNoteUrlForLinkingTo(const Note &note, bool forceLegacy) const {

// if one of the link characters `<>()` were found in the note url use
// the legacy way of linking because otherwise the "url" would break the
// markdown link
// Markdown link
static const QRegularExpression re(QRegularExpression(R"([<>()])"));
if (noteUrl.contains(re)) {
noteUrl = getNoteUrlForLinkingTo(note, true);
Expand Down Expand Up @@ -2209,7 +2209,7 @@ bool Note::removeNoteFile() {
}

/**
* @brief Returns html rendered markdown of the note text
* @brief Returns html rendered Markdown of the note text
* @param notesPath for transforming relative local urls to absolute ones
* @param maxImageWidth defined maximum image width (ignored if forExport is
* true)
Expand Down Expand Up @@ -2338,7 +2338,7 @@ static std::vector<ImageSize> *getImageSizeCache() {
}

/**
* Converts a markdown string for a note to html
* Converts a Markdown string for a note to html
*
* @param str
* @param notesPath
Expand Down Expand Up @@ -2371,7 +2371,7 @@ QString Note::textToMarkdownHtml(QString str, const QString &notesPath, int maxI
windowsSlash = "/";
#endif

// remove frontmatter from markdown text
// remove frontmatter from Markdown text
if (str.startsWith(QLatin1String("---"))) {
static const QRegularExpression re(
QStringLiteral(
Expand All @@ -2387,7 +2387,7 @@ QString Note::textToMarkdownHtml(QString str, const QString &notesPath, int maxI
QRegularExpression::escape(notesPath) + QStringLiteral("/\\2\\3"));

// transform images without "file://" urls to file-urls (but we better do
// that in the html, not the markdown!)
// that in the html, not the Markdown!)
// str.replace(
// QRegularExpression(R"((\!\[.*\]\()((?!file:\/\/).+)(\)))"),
// "\\1file://" + windowsSlash +
Expand All @@ -2397,7 +2397,7 @@ QString Note::textToMarkdownHtml(QString str, const QString &notesPath, int maxI
QRegularExpressionMatchIterator i;

// Try to replace links like <my-note.md> or <file.pdf> with proper file
// links We need to do that in the markdown because Hoedown would not create
// links We need to do that in the Markdown because Hoedown would not create
// a link tag This is a "has not '\w+:\/\/' in it" regular expression see:
// http://stackoverflow.com/questions/406230/regular-expression-to-match-line-that-doesnt-contain-a-word
// TODO: maybe we could do that per QTextBlock to check if it's done in comment blocks?
Expand All @@ -2422,7 +2422,7 @@ QString Note::textToMarkdownHtml(QString str, const QString &notesPath, int maxI
// attachment links! We are using `{1,500}` instead of `+` because there
// were crashes with regular expressions running wild
// TODO: In theory we could convert relative note links in the html (and not
// in the markdown) to prevent troubles with code blocks
// in the Markdown) to prevent troubles with code blocks
i = QRegularExpression(QStringLiteral(R"(\[(.*?)\]\((((?!\w+:\/\/)[^<>]){1,500}?)\))"))
.globalMatch(str);

Expand All @@ -2442,7 +2442,7 @@ QString Note::textToMarkdownHtml(QString str, const QString &notesPath, int maxI
QStringLiteral(")"));
}

// check if there is a script that wants to modify the markdown
// check if there is a script that wants to modify the Markdown
const QString preScriptResult =
ScriptingService::instance()->callPreNoteToMarkdownHtmlHook(this, str, forExport);

Expand Down Expand Up @@ -2491,7 +2491,7 @@ QString Note::textToMarkdownHtml(QString str, const QString &notesPath, int maxI
}

// transform images without "file://" urls to file-urls
// Note: this is currently handled above in markdown
// Note: this is currently handled above in Markdown
// if we want to activate this code again we need to take care of
// remote http(s) links to images! see:
// https://github.com/pbek/QOwnNotes/issues/1286
Expand Down Expand Up @@ -3393,7 +3393,7 @@ QString Note::createNoteHeader(const QString &name) {
}

/**
* Returns the markdown of the inserted media file into a note
* Returns the Markdown of the inserted media file into a note
*/
QString Note::getInsertMediaMarkdown(QFile *file, bool addNewLine, bool returnUrlOnly,
QString title) const {
Expand Down Expand Up @@ -3512,7 +3512,7 @@ QString Note::attachmentUrlStringForFileName(const QString &fileName) const {
}

/**
* Returns the markdown of the inserted attachment file into a note
* Returns the Markdown of the inserted attachment file into a note
*/
QString Note::getInsertAttachmentMarkdown(QFile *file, QString title, bool returnUrlOnly,
QString fileBaseName) const {
Expand Down Expand Up @@ -3561,7 +3561,7 @@ QString Note::getInsertAttachmentMarkdown(QFile *file, QString title, bool retur
}

/**
* Downloads an url to the media folder and returns the markdown code or the
* Downloads an url to the media folder and returns the Markdown code or the
* url for it relative to the note
*
* @param url
Expand Down Expand Up @@ -3594,7 +3594,7 @@ QString Note::downloadUrlToMedia(const QUrl &url, bool returnUrlOnly) {
if (tempFile->open()) {
// download the image to the temporary file
if (Utils::Misc::downloadUrlToFile(url, tempFile)) {
// copy image to media folder and generate markdown code for
// copy image to media folder and generate Markdown code for
// the image
text = getInsertMediaMarkdown(tempFile, true, returnUrlOnly);
}
Expand All @@ -3606,7 +3606,7 @@ QString Note::downloadUrlToMedia(const QUrl &url, bool returnUrlOnly) {
}

/**
* Imports an image from a base64 string and returns the markdown code
* Imports an image from a base64 string and returns the Markdown code
*
* @param data
* @param imageSuffix
Expand Down Expand Up @@ -3645,7 +3645,7 @@ QString Note::importMediaFromBase64(QString &data, QString imageSuffix) const {

/**
* Tries to import a media file into the note and returns the code for the
* markdown image tag
* Markdown image tag
*/
QString Note::importMediaFromDataUrl(const QString &dataUrl) {
if (dataUrl.contains(QLatin1String("data:image/"), Qt::CaseInsensitive)) {
Expand Down
6 changes: 3 additions & 3 deletions src/helpers/qownnotesmarkdownhighlighter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* QPlainTextEdit markdown highlighter
* QPlainTextEdit Markdown highlighter
*/

#include "qownnotesmarkdownhighlighter.h"
Expand Down Expand Up @@ -44,7 +44,7 @@ void QOwnNotesMarkdownHighlighter::updateCurrentNote(Note *note) {
}

/**
* Does the markdown highlighting
* Does the Markdown highlighting
* We need to override this method so our highlightMarkdown gets called
*
* @param text
Expand All @@ -57,7 +57,7 @@ void QOwnNotesMarkdownHighlighter::highlightBlock(const QString &text) {
setCurrentBlockState(HighlighterState::NoState);
currentBlock().setUserState(HighlighterState::NoState);

// do the markdown highlighting before the spellcheck highlighting
// do the Markdown highlighting before the spellcheck highlighting
// if we do it afterward, it overwrites the spellcheck highlighting
MarkdownHighlighter::highlightMarkdown(text);
if (text.contains(QLatin1String("note://")) ||
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/qownnotesmarkdownhighlighter.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* QPlainTextEdit markdown highlighter
* QPlainTextEdit Markdown highlighter
*/

#pragma once
Expand Down

0 comments on commit 1c227d3

Please sign in to comment.