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

Syntax for indent and alignment #803

Closed
vkbo opened this issue Jun 9, 2021 · 0 comments · Fixed by #804
Closed

Syntax for indent and alignment #803

vkbo opened this issue Jun 9, 2021 · 0 comments · Fixed by #804
Assignees
Labels
enhancement Request: New feature or improvement

Comments

@vkbo
Copy link
Owner

vkbo commented Jun 9, 2021

I've been playing around with various syntax to allow for manipulate the indentation and alignment of single paragraphs.

The need re-emerged after I just read a book that uses it to illustrate when something is read from a signe (centred text) or some written correspondence is quoted (larger margins). These are quite useful features to have, and should be available in the editor.

The syntax I've come up with is rather simple and intuitive I think. Essentially it consists of using the > and < symbols at the start or end of the paragraph to "push" it away from the edge. A single > or < will indent the text by a tab-stop width. A double of either will push it maximally way from the edge. Effectively, the combinations will result in:

  • > some text will result in a left-indented paragraph.
  • some text < will result in a right-indented paragraph.
  • > some text < will result in a left- and right-indented paragraph.
  • >> some text will result in a right-aligned paragraph.
  • some text << will result in a left-aligned paragraph.
  • >> some text << will result in a centred paragraph.

These can also be combined, for instance:

  • >> some text < will result in a right-aligned paragraph with a wider right margin.

The left alignment is not only added for completeness. Title pages and partition pages are by default centre-aligned, so if you want to add text to them that isn't centred, you need to apply left alignment.

These are almost trivial to implement. The highlighter will give the correctly used tags a control character colour. Parsing it in the tokenizer class will set the paragraph alignment. The HTML and ODT generators already have all the code to handle alignment as alignment is already a part of the code, so all that is needed is detecting the leading and trailing angle brackets in the text line.

The syntax is also fairly clean, and since it will not be used much in a project, not very intrusive.

This feature would effectively replace #595.

@vkbo vkbo self-assigned this Jun 9, 2021
@vkbo vkbo added the enhancement Request: New feature or improvement label Jun 9, 2021
@vkbo vkbo added this to the Release 1.4 Beta 1 milestone Jun 9, 2021
@vkbo vkbo mentioned this issue Jun 9, 2021
3 tasks
@vkbo vkbo linked a pull request Jun 10, 2021 that will close this issue
3 tasks
@vkbo vkbo mentioned this issue Jun 10, 2021
@vkbo vkbo closed this as completed Jun 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Request: New feature or improvement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant