Uh oh!
There was an error while loading. Please reload this page.
Add element tagging functionality - #467
Conversation
damithc
commented
Dec 12, 2018
Yes, that's fine too. Shouldn't we allow multiple tags i.e., Tagged elements are shown by default or hidden by default? |
They're always hidden by default unless a matching tag is specified. I'm not sure about multiple tags... Does that mean if a single tag matches, we display the element? |
acjh
commented
Dec 12, 2018
|
damithc
commented
Dec 13, 2018
Sounds good.
For this round, yes, we can do that. But eventually we are are going to need a
I prefer to not use site.json vs frontmatter: note that tag filtering need not be site-wide. Ideally, there should be a way to specify it for a group of files. |
yamgent
commented
Dec 13, 2018
I think that it is a good idea going in the direction of allowing MarkBind to be extensible in the future. Separating the core logic with the "additional" features would create a good foundation for such a plugin system. |
jamos-tay
commented
Dec 13, 2018
Changes: Simplified tags: I think we can just use the I left in the front matter functionality - do we want it in? Either way it's only a couple of lines of code changed so it's not a big thing Is having both include and exclude necessary? I think it's sufficient to either include all and the user specifies Regarding the plugin thing, I think that's a great idea. It should be in its own PR though, I'll create another issue. We can migrate other functionalities (like anchors) to plugins too |
damithc
commented
Dec 13, 2018
While one can be used in place of the other, depending on the reuse context, one is usually more convenient than the other. Sometimes you want to say |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
8b436f4 to
20a93a2Comparejamos-tay
commented
Dec 17, 2018
Updated |
Uh oh!
There was an error while loading. Please reload this page.
a14afe2 to
ba27434Comparejamos-tay
commented
Dec 18, 2018
Updated |
yamgent
left a comment
There was a problem hiding this comment.
Will need you to resolve the conflicts as the lib -> src thing has been merged recently.
Some more nits in documentation.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
2b5c18e to
0f08927Compare
acjh
left a comment
There was a problem hiding this comment.
Suggested improvements to phrasing and style.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| </frontmatter> | ||
| ``` | ||
| Tags in the `frontmatter` will take precedence over the ones in `site.json`. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
damithc
commented
Dec 22, 2018
Actually, this precedence order is problematic for reuse. To paraphrase the open-closed principle from OOP, we should be able to extend existing pages (for reuse) without modifying them. i.e., we should be able to reuse a page without modifying its content while overriding its behavior using some external means, such as the |
acjh
commented
Dec 22, 2018
Agreed, |
Sure - can change the order. Will change the other one in a separate PR. Updated |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
jamos-tay
commented
Jan 14, 2019
Updated |
yamgent
left a comment
There was a problem hiding this comment.
Comments about the documentation.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
jamos-tay
commented
Jan 18, 2019
Updated |
@jamos-tay can you resolve conflict for this PR? Thanks! |
Allow single value tag without list
Clarify heading
76f7d9c to
ad5ec3fComparejamos-tay
commented
Jan 21, 2019
Rebased on master! |
damithc
commented
Jan 29, 2019
@jamos-tay is it possible to override frontmatter tags of a specific page/glob from site.json? Or site.json tags can only apply to the entire site? |
yamgent
commented
Jan 30, 2019
Currently it applies to the entire site only, no way to do it for a particular page. The current overriding mechanism is also rather aggressive atm: I realize that it is not true that we don't lose any functionality for not categorizing tags into different groups. Consider this scenario:
<divtags="level--beginner">
This is how you do Hello World:
<codetags="lang-cs">Console.WriteLine("Hello World");</code><codetags="lang-java">System.out.println("Hello World");</code></div><divtags="level--advanced">
Let's do a refresher. Recall that to print anything, you would use <codetags="lang-cs">Console.WriteLine()</code><codetags="lang-cs">println()</code>.
<question>
How would you print the string "Hello World"?
...
</question></div>
<frontmatter>
tags: lang-cs
</frontmatter><includesrc="helloWorld-fragment.mbdf" />
<frontmatter>
tags: lang-java
</frontmatter><includesrc="helloWorld-fragment.mbdf" />I want two different websites: for beginner, and for advanced. Both of these websites will render |
damithc
commented
Jan 30, 2019
@jamos-tay perhaps we can do another iteration for this feature to iron out these rough edges? |
jamos-tay
commented
Jan 30, 2019
Hmm... I think what we can do is a tag merge, i.e. instead of overwriting the frontmatter tags completely we merge them instead. We probably should have done it this way earlier. |
damithc
commented
Feb 2, 2019
@jamos-tay don't forget this one too. In addition, should we also have a way to specify tags at the point of inclusion, the same way we allow overriding variables at the point of inclusion? |

What is the purpose of this pull request? (put "X" next to an item, remove the rest)
• [X] New feature
Fixes#435
What is the rationale for this request?
The user may want to be able to show/hide certain elements from a page depending on the deploy configuration.
Cited use case:
When generating multiple sites with only slightly differing content, it might be easier to store all the information in one page, and allow the author to show/hide them. For example, if I have a Java tutorial page and a C# tutorial page, the text content can be exactly the same, only the code will differ:
The user can then deploy a Java or a C# version of the site without having two projects.
What changes did you make? (Give an overview)
Functionality implemented based on what was discussed here: #435 (comment)
Tags (
{tagType}--{tagName}) are added to any HTML element.User can specify which tags to include in site.json or frontmatter. Frontmatter takes precedence.
Only elements with tags in site.json are displayed, rest are hidden.
Simplified from
include: { type: 'lang', include: ['java'] }to justinclude: { 'lang': ['java'] }though.Is there anything you'd like reviewers to focus on?
Behavior works according to spec, but I'm wondering if it's a little unintuitive - do we want to mandate categorizing tags into different types (
langetc.) rather than just having general use tags, without the{type}--? I.e.include : ['tag1', 'tag2' ... ]I don't think we lose any functionality by having the latter.