Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: italics for previewing underscore-delimited sequences #1160

Closed
brainchild0 opened this Issue Mar 1, 2019 · 13 comments

Comments

Projects
None yet
2 participants
@brainchild0
Copy link

brainchild0 commented Mar 1, 2019

The preview mode appears to render underlining for sequences delimited by single underscores, and italics for those delimited by single asterisks. (Bold typesetting is used both for text delimited by two underscores and that delimited by two asterisks.)

The use of underlining for these sequences appears to be a deviation from common MarkDown dialects [1-2]. As such, the display does not interoperate well with MarkDown text from other sources. Italicized text sequences that display elegantly in other environments appear awkward and cluttered in QOwnNotes.

I understand the sensibility for supporting underlining text, but it is in fact not needed in most typesetting. Underlining has principally been used for titles and similar text, as a substitute for italicization, when it is unavailable.

Users who need to publish underlined text from MarkDown sources can use custom stylesheets, but for standard previewing, I would suggest using styling familiar to most MarkDown users.


Note: This text, rendered by GitHub, is represented in the below MarkDown

_Note: This text, rendered by GitHub, is represented in the below MarkDown_

Version: 19.2.5 - Launchpad PPA - build 522


[1] GitHub Flavored Markdown Spec
[2] CommonMark

@pbek

This comment has been minimized.

Copy link
Owner

pbek commented Mar 1, 2019

Can you please explain step by step what you did, what happened and what you expected (with examples). :)

@brainchild0

This comment has been minimized.

Copy link
Author

brainchild0 commented Mar 1, 2019

Steps to reproduce:

  1. Create a new note:
  2. Copy the below text to the note body:
    *italic*  
    _underline_  
    **bold**  
    __bold__
    

Current behavior: Word "underline" is underlined.

Expected behavior: Word "underline" is italicized, but not underlined.

@pbek

This comment has been minimized.

Copy link
Owner

pbek commented Mar 1, 2019

Thank you. So is there a syntax for "underline"?
Even markdown-it renders _underline_ with underline...

@brainchild0

This comment has been minimized.

Copy link
Author

brainchild0 commented Mar 1, 2019

So is there a syntax for "underline"?

There are two answers: No and no:

  1. No: MarkDown has no syntax for underline, or for italics, or for bold. MarkDown syntax represents logical formatting distinctions, which a processor and style specification represent following concrete style rules. MarkDown supports three levels of emphasis, indicated by delimitation by one, two, or three consecutive appearances of either of two indicators: * and _. Distinction is not made for one indicator versus the other, though it is required to terminate a particular emphasized sequence using the same indicator as began it. These rules are clarified with serious rigor in Section 6.4 of the CommonMark specification.

  2. No: Historically, a typeface family would generally comprise four styles, corresponding to all four combinations or normal and slanted shape, and normal and heavy weight (i.e. the four combinations being called regular, italics, bold, and bold italics). (Other variations might also be available in some families.) How to invoke these styles when printing various publications, such as text from a manuscript, or tabular information, or other kinds, was the typesetter's decision, though various conventions became prominent.

    That three levels of emphasis are supported in MarkDown is unlikely accidental, since these three levels, plus the case of no emphasis, together make four possibilities, equal to the number of style choices historically available in a type family. Conventionally, these four possibilities are represented, with ascending levels of emphasis, as normal, italics, bold, and bold italics. For example, the CommomMark literature nowhere uses the terms bold or italics in the main specification, but plainly represents the convention in its quickstart guide.

    Underlining has been rarely used in classical typesetting, but in material written by hand or typewriter, various counts of underlines have been used as a method of emphasis, particularly with a single underline employed as a substitute for italics. As a child, my school teachers taught me to underline book titles referenced within our own writing. We were of course writing by hand. (And in cases where the teacher had a serious reaction to what I wrote, the paper might be returned to me with comments featuring one, two, three, or even four levels of underline!) Writing in stylized computer text, including MarkDown, I will use whatever formatting element is mapped to italics to represent titles of books, films, publications, and other major works. Most published texts, I think you will find, use the same convention. I will also occasionally use this same style for auxiliary notes within the text, which sometimes span an entire paragraph. An underlined style is particularly bad aesthetically in this case.

    I will never deliberately employ underlining in computer text, as its use in this context is largely vestigial from handwriting and typewriters.

    (Previously, representations of hyperlinks would often use underlining, as in the default styles for early web browsers, though this style has fallen out of favor, at least for the non-rollover case.)

@pbek

This comment has been minimized.

Copy link
Owner

pbek commented Mar 2, 2019

The problem is that implementing this will break current functionality and the hoedown markdown parser will not support it. :/

@brainchild0

This comment has been minimized.

Copy link
Author

brainchild0 commented Mar 2, 2019

From src/html.h, the function hoedown_html_renderer() returns a default (X)HTML renderer.

/* hoedown_html_renderer_new: allocates a regular HTML renderer */
hoedown_renderer *hoedown_html_renderer_new(
	hoedown_html_flags render_flags,
	int nesting_level
) __attribute__ ((malloc));

The semantics in this library are nonstandard given the considerations listed above. The renderer contains separate fields rndr_underline and rndr_emphasis. However, I think you could simply assign the former field to the latter from the default renderer that is generated.

It would be more common that a library would generate the logical HTML tags and attach a CSS stylesheet. If you could use a stylesheet, then you could override the display properties of the <u> tag.

@pbek pbek added the enhancement label Mar 3, 2019

@pbek

This comment has been minimized.

Copy link
Owner

pbek commented Mar 3, 2019

19.3.0

  • added an option to disable underline rendering in the preview to the Preview settings

@pbek pbek added this to the 19.3.0 milestone Mar 3, 2019

pbek added a commit that referenced this issue Mar 3, 2019

@pbek

This comment has been minimized.

Copy link
Owner

pbek commented Mar 3, 2019

There now is a new release, could you please test it and report if it works for you?

@brainchild0

This comment has been minimized.

Copy link
Author

brainchild0 commented Mar 3, 2019

Thank you for making the change. Italics now appear, where underlining had appeared, whether or not the option is selected.

@pbek

This comment has been minimized.

Copy link
Owner

pbek commented Mar 3, 2019

For me _test_ is underlined in the preview if the checkbox is checked.

@brainchild0

This comment has been minimized.

Copy link
Author

brainchild0 commented Mar 3, 2019

It works, correctly. I'm sorry. I momentarily forgot we are talking only about the preview pane.

@pbek

This comment has been minimized.

Copy link
Owner

pbek commented Mar 3, 2019

;)

@pbek pbek closed this Mar 3, 2019

@brainchild0

This comment has been minimized.

Copy link
Author

brainchild0 commented Mar 4, 2019

Of course, some might find it confusing in general that the editor pane shows italics and the preview shows underline (by default).

Going forward, I intend to use the new option, so both panes will display italics.

Thanks again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.