Giter VIP home page Giter VIP logo

Comments (7)

pbek avatar pbek commented on May 29, 2024

Is there an option to disable the behaviour of --- or === creating sub headlines?

Which behaviour are we takling about? 😅

Or at least/also an option just to disable the background highlighting of these?

You could customize the styling completely like QOwnNotes does.

from qmarkdowntextedit.

nuttyartist avatar nuttyartist commented on May 29, 2024

Which behaviour are we takling about? 😅

Screen Shot 2023-07-04 at 8 29 21 AM

Is there an option to disable the creation of headers by dashes/equals below text, and to remove the background color on dashes in the second example?

from qmarkdowntextedit.

pbek avatar pbek commented on May 29, 2024

Is there an option to disable the creation of headers by dashes/equals below text

No, not really, that's just Markdown. Why would you want to disable that specific syntax of Markdown?
You could always just override the one method that applies that highlighting.

and to remove the background color on dashes in the second example?

You can just override the style, like in:

https://github.com/pbek/QOwnNotes/blob/22f7016849cce3d2f01a35c1eb62f9869029a26e/src/widgets/qownnotesmarkdowntextedit.cpp#L184

https://github.com/pbek/QOwnNotes/blob/22f7016849cce3d2f01a35c1eb62f9869029a26e/src/widgets/qownnotesmarkdowntextedit.cpp#L124

from qmarkdowntextedit.

nuttyartist avatar nuttyartist commented on May 29, 2024

No, not really, that's just Markdown. Why would you want to disable that specific syntax of Markdown?

Sometimes I (and I believe many others, especially non Markdown users) just want to create a line seperator below some text without formatting the text above it as a header. But I think I'll keep the current behavior, it's just good to know I can ovveride it.

You can just override the style, like in:

Awesome, thanks!

Two more questions:

  1. I want to set the font size for code blocks, so they're smaller than the regular text. So I did something like that:
qreal codeBlockFontSize = fontSize - 2;
    _formats[static_cast<HighlighterState>(HighlighterState::InlineCodeBlock)].setFontPointSize(codeBlockFontSize);
    _formats[static_cast<HighlighterState>(HighlighterState::CodeBlock)].setFontPointSize(codeBlockFontSize);
    _formats[static_cast<HighlighterState>(HighlighterState::CodeBlockComment)].setFontPointSize(codeBlockFontSize);

But the size of some syntex of cpp stays the same while the rest does gets smaller (I set a very small number below just to show the difference):

Screen Shot 2023-07-09 at 10 43 58 AM

  1. Do you think you can add marking/highlighting a piece of text syntax like Bear is doing here with two colons around a piece of text to highlight it?

Screen Shot 2023-07-09 at 10 48 05 AM

from qmarkdowntextedit.

pbek avatar pbek commented on May 29, 2024
  1. hard to tell without actually playing around with the code
  2. since that's no Markdown syntax, it's best to implement that somewhere else. QOwnNotes for example has a script function to do that

from qmarkdowntextedit.

nuttyartist avatar nuttyartist commented on May 29, 2024

That's our customMarkdownHighlighter.cpp. Did I miss any HighlighterState in my code above?

from qmarkdowntextedit.

pbek avatar pbek commented on May 29, 2024

Well, there are lots of code-states:

enum HighlighterState {
NoState = -1,
Link = 0,
Image = 3,
CodeBlock,
CodeBlockComment,
Italic = 7,
Bold,
List,
Comment = 11,
H1,
H2,
H3,
H4,
H5,
H6,
BlockQuote,
HorizontalRuler = 21,
Table,
InlineCodeBlock,
MaskedSyntax,
CurrentLineBackgroundColor,
BrokenLink,
FrontmatterBlock,
TrailingSpace,
CheckBoxUnChecked,
CheckBoxChecked,
StUnderline,
// code highlighting
CodeKeyWord = 1000,
CodeString = 1001,
CodeComment = 1002,
CodeType = 1003,
CodeOther = 1004,
CodeNumLiteral = 1005,
CodeBuiltIn = 1006,
// internal
CodeBlockIndented = 96,
CodeBlockTildeEnd = 97,
CodeBlockTilde = 98,
CodeBlockTildeComment,
CodeBlockEnd = 100,
HeadlineEnd,
FrontmatterBlockEnd,
// languages
/*********
* When adding a language make sure that its value is a multiple of 2
* This is because we use the next number as comment for that language
* In case the language doesn't support multiline comments in the
* traditional C++ sense, leave the next value empty. Otherwise mark the
* next value as comment for that language. e.g CodeCpp = 200
* CodeCppComment = 201
*/
CodeCpp = 200,
CodeCppComment = 201,
CodeJs = 202,
CodeJsComment = 203,
CodeC = 204,
CodeCComment = 205,
CodeBash = 206,
CodePHP = 208,
CodePHPComment = 209,
CodeQML = 210,
CodeQMLComment = 211,
CodePython = 212,
CodeRust = 214,
CodeRustComment = 215,
CodeJava = 216,
CodeJavaComment = 217,
CodeCSharp = 218,
CodeCSharpComment = 219,
CodeGo = 220,
CodeGoComment = 221,
CodeV = 222,
CodeVComment = 223,
CodeSQL = 224,
CodeJSON = 226,
CodeXML = 228,
CodeCSS = 230,
CodeCSSComment = 231,
CodeTypeScript = 232,
CodeTypeScriptComment = 233,
CodeYAML = 234,
CodeINI = 236,
CodeTaggerScript = 238,
CodeVex = 240,
CodeVexComment = 241,
CodeCMake = 242,
CodeMake = 244,
CodeNix = 246,
CodeForth = 248,
CodeForthComment = 249
};

from qmarkdowntextedit.

Related Issues (20)

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.