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

highlight boxes #33

Open
MartinKies opened this issue Sep 21, 2020 · 5 comments
Open

highlight boxes #33

MartinKies opened this issue Sep 21, 2020 · 5 comments

Comments

@MartinKies
Copy link
Contributor

I just changed a few things in the LeverageData Fork

The most important ones are:

  • Highlight Boxes (see https://leveragedata.shinyapps.io/HighlightExample/)
  • Various changes regarding output_solution to fix inconsistencies between knitr and shiny [probably] by retroactively changing some of the source code. Mainly by adding or deleting line breaks and blank lines. Additionally a possible top level header (# ...) will be used instead of the problem set name for the Header of the output_solution.
  • A small fix regarding info_blocks, which may now have the same title. Previously the last info block with the same title overrode the content of the previous ones with the same title.
@skranz
Copy link
Owner

skranz commented Sep 22, 2020

The highlight boxes look very nice. Thanks for the update. Maybe one suggestion. Perhaps instead of defining styles by a shortened name, like

<style>
.highlight_base_Youshouldknow {
    background-color: #88FF8F;
    padding: 0 2em 1em;
    margin: 2.5em 2.5em 2.5em 2.5em;
}
</style>

perhaps it may make more sense to have a style_class argument, like

#< highlight style_class="mystyle"

and then define CSS styles like

<style>
.highlight_base_mystyle {
    background-color: #88FF8F;
    padding: 0 2em 1em;
    margin: 2.5em 2.5em 2.5em 2.5em;
}
</style>

So you can easily use different forms of highlights, like warnings, remarks, etc...

@skranz
Copy link
Owner

skranz commented Sep 22, 2020

Another remark:
I have updated the automatic hint for dplyr chains (mostly relevant if there are still placeholders ___), which looked very ugly so far:
d727b11

I now also set show.revert.btn=TRUE by default in show.ps:
f1a9446

There still seems to be sometimes as bug that the given code vanishes in the shiny version, when RTutor automatically jumps to edit the next chunk when the previous chunk was successfully checked. Have you also observed this behavior? I had not yet time to dig deeper into it. Such bugs at only appear sometimes are always tricky to debug. But at least with the "Original Code" button users can always retrieve the originally given code, should that bug occur.

@MartinKies
Copy link
Contributor Author

Thank you for your suggestion! I still opted for the named block as the default case as I want it to make it as easy as possible for the author to write content without having to think about design.

Nevertheless it is now possible to completely seperate content and style, which might be useful in some instances: https://leveragedata.shinyapps.io/HighlightExample/

We do indeed use different forms of highlights (in particular Attentions and Remarks) but those always have the same title within their class (i.e. I want to have always the same design for all Attention Blocks). With the class feature it is now possible to have seperate groups of designs within the same title-group.

It also allows to have varying titles with the same design which was not a use case I previously thought about, as I currently only use strictly defined groups in my courses.

Regarding the other points:

Thank you for your info regarding the dplyr hints and the show.revert.button. I have both integrated.

Yes, we also experience this bug - and have unfortunately currently no good lead regarding its source. If you fix it, a note would be nice. Should we stumble upon the solution, we will open a new issue.

Regarding future development of our fork: Most of the previous changes where aimed at reducing time and complexity of the author(s) (The Highlight Boxes for example where previously achieved by using html hax and the aftercare shiny -> html script by manual processes). I think the most pressing issues are now resolved.

Maybe I will introduce an tag which can be used within html blocks to allow rmd formatting within a html block. This is relevant if for example one has formatted html-tables (instead of rmd-tables) and wants for example to use Math-Syntax within a cell. This is currently rather inconvenient as rmd-code does not get interpreted within html tags and manual MathJax is not very authorfriendly.

The next big thing will most likely be a complete extraction of all user-sided texts and putting them in a language file for roll-out in different languages (e.g. German but also to allow course-specific Texts independent of the specific task).

@skranz
Copy link
Owner

skranz commented Sep 22, 2020

Just some short thoughts on your comment:

Maybe I will introduce an tag which can be used within html blocks to allow rmd formatting within a html block. This is relevant if for example one has formatted html-tables (instead of rmd-tables) and wants for example to use Math-Syntax within a cell. This is currently rather inconvenient as rmd-code does not get interpreted within html tags and manual MathJax is not very authorfriendly.

Hmm, not sure whether writing something like

<table><tr><td>
#< md
$x^2$
#>
</td></tr></table>

is more convenient than the pure HTML solution

<table><tr><td>
\(x^2\)
</td></tr></table>

Perhaps, if you don't want to teach your co-workers a bit HTML, it might be more convenient to define an outer block, like #< md_html so that all HTML text inside will be rendered as markdown. But it is not clear to me how easy that is to implement. This discussion may help (you could use commonmark for rendering such blocks):

https://stackoverflow.com/questions/29368902/how-can-i-wrap-my-markdown-in-an-html-div

Alternatively, you use some rvest & htmltools function to acces the text attributes of all html elements and run a markdown converter on them.

@MartinKies
Copy link
Contributor Author

Thank you for your input! I did not know this command - this is a lot more elegant than what I did until now. I suppose stuff like emphasize and bolding etc. is not to difficult so when the Math Stuff ist taken care of this certainly lowers this issue a lot in the priority list.

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