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

Custom formatting commands #5

Open
fabiocolacio opened this issue May 7, 2018 · 4 comments
Open

Custom formatting commands #5

fabiocolacio opened this issue May 7, 2018 · 4 comments

Comments

@fabiocolacio
Copy link

One of the most powerful features of LaTeX in my opinion is the ability to create custom commands and environments.

Although the way Scidown works is fundamentally different, we might be able to reproduce this with CSS.

It would be cool if we could do something like this:

@new_style{red_italic_text}
/* CSS rules here */
color: red;
font-style: italic;
@/

This is normal text.
This text follows the CSS rules of our stylesheet (if there is one.)
asdf
asdf
asdf
asdf

@red_italic_text
This text is in our custom environment.
Our stylesheet rules for these blocks are overwritten by the user-defined styles.
This text is all red and italicized.
@/

In practice, the css code in the new_style block would be added to the document for the html class .red_italic_text. Then all of the html tags inside of the @red_italic_text @/ block would have class=".red_italic_text".

@fabiocolacio
Copy link
Author

I added this feature in my own fork of scidown, but I'm not sure how useful this is, because for the user it takes about the same amount of work as typing:

<style>
.red_italic_text {
    color: red;
    font-style: italic;
}
</style>

<div class="red_italic_text">
This is the red italic text
</div>

If you think there is still value in adding this as custom syntax, lef me know and I can submit a PR

@Mandarancio
Copy link
Owner

I'm not sure as it would be very complex to render similar output to latex and I think it would be better or creating some sort of universal style sheet language that translate both to css and to latex or to have smaller and simpler command such as @color() or @fontsize() to customize the output.
What do you think?

@fabiocolacio
Copy link
Author

Maybe we can combine the two.

We can implement individual commands like @color() @fontsize(), etc. (including common things that work with both LaTeX and CSS).

We can then also add the @new_style command, but it would only work with our formatting options instead of any css.

This would allow for both quick inline usage like this:

I like the color @color(#ff0000){red}

As well as easy reuse of commands:

@new_style(red_italic)
     @color(#ff0000)
     @fontfamily(italic)
@/

@red_italic{This} is red and italic; So is @red_italic{this}.

Ideally, we would be able to nest user-defined styles as well:

@new_style(bold_red_italic)
    @bold
    @red_italic // the style we defined earlier
@/

@Mandarancio
Copy link
Owner

Yes I think it could be a good Idea, so can you do a PR?
Thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants