View tiddler with source code in pre block with syntax highlighting - syntax-highlighting

I have a tiddler that contains SQL source code. I am embedding it into another tiddler using the $codeblock macro, and that works wonderfully.
When I view the source tiddler (the first one), I'd like to get it formatted like the embedded one (in a pre block with syntax highlighting applied).
I noticed Tiddlywiki can do this for Stylesheets, when you set a tiddler type to text/css. How can I do the same for other custom types? I've combed the docs but haven't found anything so far, but I freely admit I may be using the wrong terminology in my search. I've also struggled to find the source code that does the pre wrapping for stylesheet tags.
Anyone know how I'd do this?

Related

How to fix 'Link Highlighting in Inline Code'?

The method of writing a code element in Asciidoc is by writing an element enclosed in the grave accent(`):
`var`
And, the method to show a link is:
link:www.awebistelink.com[var]
I am attaching an image to show these two on a website that renders Asciidoc
Image Displaying the output in an asciidoc document
When I am trying to show a link highlight of a code element inside an inline code by writing:
`link:www.awebistelink.com[var]`
It renders perfectly fine on Asciidoc Please see it here
But on the website, it doesn't show any link, and simply shows a code element like as if we declared it simply as
`var`
The correct way to make a link label appear in monospace is to apply the backticks to the label itself, not the link.
Using your example, the markup should be:
link:www.awebsitelink.com[`var`]
I found the answer,
it should be
`link:www.awebistelink.com[var]`
I still don't know how it worked but now it works just fine as intended.

Vue.js Component Template Type

At my company, for templates for Vue.js, we write components in separate Blade files. The problem I have is that HTML code is not highlighted in those files. Whole HTML code is written inside script tags which has the syntax:
<script type="x/templates" id="nameOfComponent">.
By deleting the type attribute, highlighting starts working correctly. I have searched a little bit and found that there are different types, but I have never seen one like the one above (the closest one I saw is text/x-template and highlighting works with it). Now, as I am not allowed to change these kinds of things, I have a couple of questions (also, I have to mention I'm new to JavaScript and PHP):
If this is not predefined type, are user-defined types supported?
If so, is there any extension for VS code which would highlight HTML part of the code?
If user-defined types are not the right solution, which one would be the best solution for me?
try:
https://github.com/vuejs/vetur
Pretty sure it should support vue template syntax highlighting.

Dynamically change caption field (or just title in tabs macro) in TiddlyWiki

I'm putting together some TiddlyWiki templates, and I've run into something that would be nice to have, but I'm not sure whether it's actually possible.
I have some tiddlers that I'm including in another tiddler using the tabs macro. Each tiddler has one of two tags associated with it. I'd like to append a snippet of text to the caption in the tab view, based on which tag is associated.
I don't have a strong preference for whether this is done by adding some kind of callback to edit the caption on save, something that somehow calculates the desired caption on the fly, altering the invocation of the tabs macro to recalculate the caption on render, or somehow causing the templates to calculate the caption field.
I haven't found anything promising going through the documentation, but maybe I just haven't figured out what's relevant to my issue. I find that happens a lot.
Like, I'm sure I can write conditionals based on whether the tags exist, but I can't see any way to interpolate text into the caption field based on any kind of computation whatsoever.
For reference, here are my current macro invocations:
<<tabs [list[]] state:$:/state/tabPeriod template:PeriodTemplate>>
<<tabs [list[$(currentTab)$]] state:$:/state/tabEvent class:"tc-vertical" template:"EventTemplate">>
<<tabs [list[$(currentTab)$]] state:$:/state/tabScene template:"SceneTemplate">>
All of these lines are from different templates, that just pull a list of tiddlers and template-transclude them into tabs using the provided template. Currently, the tabs are captioned with the tiddler caption, if defined, and fall back to the title. I'd like to alter the caption, ideally without inserting too much boilerplate into the tiddlers.
I figured out what I need to do differently: I defined a custom macro based on the tabs macro, added the logic, and now it works fine. I basically just changed the current contents of the caption logic to:
<$set name="tv-wikilinks" value="no">
<$transclude tiddler=<<currentTab>> field="caption">
<$macrocall $name="currentTab" $type="text/plain" $output="text/plain"/>
</$transclude>
<$list filter='[<currentTab>tag[light]]'>
○
</$list>
<$list filter='[<currentTab>tag[dark]]'>
●
</$list>
</$set>
I'm not sure if I'm using the list widget correctly, but it works.

Passing Markdown Content to Ruby Function With Jekyll/Liquid

I am trying to write a jekyll plugin that will take a normal markdown file and provide some extra functionality on top of it. In particular, I need to do some (not actually) fancy things with tables. I know you can write straight HTML into a markdown file, but there is a requirement that the content folks don't want to / can't edit HTML.
As an extra wrench in the works, the mobile layout has a UX requirement that I essentially have to render the table as a group of divs as opposed to a table.
My initial thought was to pass the {{page.content}} variable to a ruby function extending Liquid::Tag. From there I was planning on parsing the markdown file and either:
1. If normal non-table markdown, use as normal
2. If table markdown, look for custom identifier in markdown, do what needs to be done (e.g. add class, etc)
If I do something like this:
def render(context)
content = Liquid::Template.parse(#markup).render context
end
It renders the context as a normal markdown file. However, I want to break up the context variable and work with the pieces before rendering. I've tried a few different approaches that I've gotten from the jekyll docs and Stack Overflow and gotten nowhere.
Does anyone have any experience with this? I am heading down the right path? For what it's worth, Ruby/Jekyll/Liquid is fairly new to me, so if you think I may have missed something fairly basic and obvious then please let me know.
A markdown table tool for editors !
markdownify your table in http://www.tablesgenerator.com/markdown_tables
paste the markdown result in http://prose.io/
done
I don't know other way to simplify editor's work on Jekyll, but I'll be very interested in earing from your project. Good luck.

How to enable Mathematica syntax highlighting for MediaWiki using extension "SyntaxHighlight GeSHi"?

I'd like to syntax highlight Mathematica code on a MediaWiki site. I've already installed
the MediaWiki extension SyntaxHighlight GeSHi and verified that it works for other languages.
I tried simply putting a Mathematica langauge data file mathematica.php into MediaWiki's extension path wiki/extensions/SyntaxHighlight_GeSHi/geshi, however it didn't correctly highlight a Mathematica code block such as:
<syntaxhighlight lang="Mathematica">
(* this is a comment *)
List[Sin[x], Cos[x], Tan[x]];
</syntaxhighlight>
Any ideas?
I do not see Mathematica listed as a supported language at http://qbnz.com/highlighter/, so I suppose GeSHi simply doesn't know it. I suppose you could contribute the respective highlighting code to the geshi project, if you like.
you need modify geshi.php, function get_language_name_from_extension to be specific, for added language definition to be recognized.

Resources